nl_tokens: Visible for testing
pl_tokens: static void readFullyDirectBuffer ( InputStream f , ByteBuffer buf , byte [ ] temp ) throws IOException { int nextReadLength = Math . <mask> ( buf . remaining ( ) , temp . length ) ; int bytesRead = 0 ; while ( nextReadLength > 0 && ( bytesRead = f . read ( temp , 0 , nextReadLength ) ) >= 0 ) { buf . put ( temp , 0 , bytesRead ) ; nextReadLength = Math . min ( buf . remaining ( ) , temp . length ) ; } if ( bytesRead < 0 && buf . remaining ( ) > 0 ) { throw new EOFException ( "Reached the end of stream with " + buf . remaining ( ) + " bytes left to read" ) ; } }