public int read ( byte [ ] buffer , int offset , int length ) throws IOException { int readLength = 0 ; while ( length > 0 ) { int sublen = _is . read ( buffer , offset , length ) ; if ( sublen < 0 ) return readLength == 0 ? - 1 : readLength ; offset += sublen ; length -= sublen ; readLength += sublen ; } return readLength ; }
Reads a chunk