/guava/android/guava/src/com/google/common/io/ByteStreams.java
bufs.add( buf) ; byte[] buf = new byte[min( bufSize, MAX_ARRAY_LEN - totalLen) ];bufSize = IntMath.saturatedMultiply( bufSize, bufSize < 4096 ? 4 : 2) ) {
bufSize = IntMath.saturatedMultiply ( bufSize, bufSize < 4096 ? 4 : 2 ) ) { byte[] buf = new byte[min ( bufSize, MAX_ARRAY_LEN - totalLen ) ]; bufs.add ( buf ) ;
private static final int TO_BYTE_ARRAY_DEQUE_SIZE = 20; private static byte[] toByteArrayInternal(InputStream in, Queue<byte[]> bufs, int totalLen) throws IOException { int initialBufferSize = min(BUFFER_SIZE, max(128, Integer.highestOneBit(totalLen) * 2)); for (int bufSize = initialBufferSize; totalLen < MAX_ARRAY_LEN; <extra_id_0> int off = 0; while (off < buf.length) { int r = in.read(buf, off, buf.length - off); if (r == -1) { return combineBuffers(bufs, totalLen); }