com.google.protobuf.ByteString.readChunk()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.2k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中com.google.protobuf.ByteString.readChunk()方法的一些代码示例,展示了ByteString.readChunk()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteString.readChunk()方法的具体详情如下:
包路径:com.google.protobuf.ByteString
类名称:ByteString
方法名:readChunk

ByteString.readChunk介绍

[英]Blocks until a chunk of the given size can be made from the stream, or EOF is reached. Calls read() repeatedly in case the given stream implementation doesn't completely fill the given buffer in one read() call.
[中]块,直到可以从流中生成给定大小的块,或者达到EOF。如果给定的流实现在一次read()调用中没有完全填充给定的缓冲区,则重复调用read()。

代码示例

代码示例来源:origin: osmandapp/Osmand

public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
  int maxChunkSize) throws IOException {
 Collection<ByteString> results = new ArrayList<ByteString>();
 // copy the inbound bytes into a list of chunks; the chunk size
 // grows exponentially to support both short and long streams.
 int chunkSize = minChunkSize;
 while (true) {
  ByteString chunk = readChunk(streamToDrain, chunkSize);
  if (chunk == null) {
   break;
  }
  results.add(chunk);
  chunkSize = Math.min(chunkSize * 2, maxChunkSize);
 }
 return ByteString.copyFrom(results);
}

代码示例来源:origin: com.google.protobuf/protobuf-java

public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
  int maxChunkSize) throws IOException {
 Collection<ByteString> results = new ArrayList<ByteString>();
 // copy the inbound bytes into a list of chunks; the chunk size
 // grows exponentially to support both short and long streams.
 int chunkSize = minChunkSize;
 while (true) {
  ByteString chunk = readChunk(streamToDrain, chunkSize);
  if (chunk == null) {
   break;
  }
  results.add(chunk);
  chunkSize = Math.min(chunkSize * 2, maxChunkSize);
 }
 return ByteString.copyFrom(results);
}

代码示例来源:origin: com.google.protobuf/protobuf-lite

public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
  int maxChunkSize) throws IOException {
 Collection<ByteString> results = new ArrayList<ByteString>();
 // copy the inbound bytes into a list of chunks; the chunk size
 // grows exponentially to support both short and long streams.
 int chunkSize = minChunkSize;
 while (true) {
  ByteString chunk = readChunk(streamToDrain, chunkSize);
  if (chunk == null) {
   break;
  }
  results.add(chunk);
  chunkSize = Math.min(chunkSize * 2, maxChunkSize);
 }
 return ByteString.copyFrom(results);
}

代码示例来源:origin: WeAreFairphone/FP2-Launcher

public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
  int maxChunkSize) throws IOException {
 Collection<ByteString> results = new ArrayList<ByteString>();
 // copy the inbound bytes into a list of chunks; the chunk size
 // grows exponentially to support both short and long streams.
 int chunkSize = minChunkSize;
 while (true) {
  ByteString chunk = readChunk(streamToDrain, chunkSize);
  if (chunk == null) {
   break;
  }
  results.add(chunk);
  chunkSize = Math.min(chunkSize * 2, maxChunkSize);
 }
 return ByteString.copyFrom(results);
}

代码示例来源:origin: yeriomin/play-store-api

public static ByteString readFrom(InputStream streamToDrain, int minChunkSize,
  int maxChunkSize) throws IOException {
 Collection<ByteString> results = new ArrayList<ByteString>();
 // copy the inbound bytes into a list of chunks; the chunk size
 // grows exponentially to support both short and long streams.
 int chunkSize = minChunkSize;
 while (true) {
  ByteString chunk = readChunk(streamToDrain, chunkSize);
  if (chunk == null) {
   break;
  }
  results.add(chunk);
  chunkSize = Math.min(chunkSize * 2, maxChunkSize);
 }
 return ByteString.copyFrom(results);
}

相关文章