public static ByteBuffer sliceAndSkip ( ByteBuffer buffer , int size ) { ByteBuffer buf = buffer . slice ( ) . order ( ByteOrder . LITTLE_ENDIAN ) ; ByteBuffer slice = ( ByteBuffer ) ( ( Buffer ) buf ) . limit ( buf . position ( ) + size ) ; skip ( buffer , size ) ; return slice ; }
Return one new ByteBuffer from current position with size the byte order of new buffer will be set to little endian ; And advance the original buffer with size .