protected int fill ( ) throws IOException { buffer . clear ( ) ; int read = decoder . decode ( in , buffer ) ; // TODO: Enforce this in test case, leave here to aid debugging if ( read > buffer . capacity ( ) ) { throw new AssertionError ( String . format ( "Decode beyond buffer (%d): %d (using %s decoder)" , buffer . capacity ( ) , read , decoder . getClass ( ) . getName ( ) ) ) ; } buffer . flip ( ) ; if ( read == 0 ) { return - 1 ; } return read ; }
Fills the buffer by decoding data from the underlying input stream .