private byte [ ] readChunk ( ) throws Exception { if ( isEndOfInput ( ) ) { return EMPTY_BYTE_ARRAY ; } try { // transfer to buffer byte [ ] tmp = new byte [ chunkSize ] ; int readBytes = in . read ( tmp ) ; if ( readBytes <= 0 ) { return null ; } byte [ ] buffer = new byte [ readBytes ] ; System . arraycopy ( tmp , 0 , buffer , 0 , readBytes ) ; offset += readBytes ; return buffer ; } catch ( IOException e ) { // Close the stream, and propagate the exception. IOUtils . closeQuietly ( in ) ; throw e ; } }
Reads a chunk .