question: public void load ( ) { try { if ( fileChannel == null ) { fileChannel = FileChannel . open ( path , StandardOpenOption . READ ) ; } fileChannel . position ( 0L ) ; buffer . clear ( ) ; tmp . clear ( ) ; while ( fileChannel . read ( tmp ) > 0 ) { tmp . flip ( ) ; if ( tmp . remaining ( ) > buffer . capacity ( ) - buffer . position ( ) ) { final ByteBuffer next = ByteBuffer . allocateDirect ( Math . max ( buffer . capacity ( ) * 2 , tmp . remaining ( ) ) ) ; buffer . flip ( ) ; next . put ( buffer ) ; buffer = next ; } buffer . put ( tmp ) ; tmp . clear ( ) ; } buffer . flip ( ) ; } catch ( final IOException e ) { throw new UncheckedIOException ( e ) ; } }
target:  Opens a channel to the specified path if it does not already exist. Allocates a larger ByteBuffer if file size &gt; current buffer size. Reads file data into ByteBuffer.