public ByteBuffer readToNextMarkerNewBuffer ( ) throws IOException { if ( done ) return null ; List < ByteBuffer > buffers = new ArrayList < ByteBuffer > ( ) ; readToNextMarkerBuffers ( buffers ) ; return NIOUtils . combineBuffers ( buffers ) ; }
Reads one full segment till the next marker . Will allocate the necessary buffer to hold the full segment . Internally uses a growing collection of smaller buffers since the segment size is intitially unkwnown .