public int read ( ByteBuffer toFill ) { int originalPos = toFill . position ( ) ; while ( dataAvailable ( ) > 0 && toFill . hasRemaining ( ) ) { readHelper ( toFill ) ; } return toFill . position ( ) - originalPos ; }
Copies into the given ByteBuffer .