public void readFrom(InputStream is, long length) throws IOException {
        int segmentSize = 1 << log2OfSegmentSize;
        int segment = 0;

        byte scratch[] = new byte[segmentSize];

        while(length > 0) {
            ensureCapacity(segment);
            long bytesToCopy = Math.min(segmentSize, length);
            long bytesCopied = 0;
            while(bytesCopied < bytesToCopy) {
                bytesCopied += is.read(scratch, (int)bytesCopied, (int)(bytesToCopy - bytesCopied));
            }
            orderedCopy(scratch, 0, segments[segment++], 0, (int)bytesCopied);
            length -= bytesCopied;
        }
    }
public void readFrom(InputStream is, long length) throws IOException {
        int segmentSize = 1 << log2OfSegmentSize;
        int segment = 0;

        byte scratch[] = new byte[segmentSize];

        while(length > 0) {
            ensureCapacity(segment);
            long bytesToCopy = Math.min(segmentSize, length);
            long bytesCopied = 0;
            while(bytesCopied < bytesToCopy) {
                bytesCopied += is.read(scratch, (int)bytesCopied, (int)(bytesToCopy - bytesCopied));
            }
            orderedCopy(scratch, 0, segments[segment++], 0, (int)bytesCopied);
            length -= bytesCopied;
        }
    }
public void readFrom ( InputStream is , long length ) throws IOException { int segmentSize = 1 << log2OfSegmentSize ; int segment = 0 ; byte scratch [ ] = new byte [ segmentSize ] ; while ( length > 0 ) { ensureCapacity ( segment ) ; long bytesToCopy = Math . min ( segmentSize , length ) ; long bytesCopied = 0 ; while ( bytesCopied < bytesToCopy ) { bytesCopied += is . read ( scratch , ( int ) bytesCopied , ( int ) ( bytesToCopy - bytesCopied ) ) ; } orderedCopy ( scratch , 0 , segments [ segment ++ ] , 0 , ( int ) bytesCopied ) ; length -= bytesCopied ; } }
Copy bytes from the supplied InputStream into this array.

@param is the source data
@param length the length of the data to copy
@throws IOException if the copy could not be performed
Copy bytes from the supplied InputStream into this array .