nl_tokens: Fills specified buffer with uncompressed data . Returns actual number of bytes of uncompressed data . A return value of 0 indicates that { @link #needsInput () } should be called in order to determine if more input data is required .
pl_tokens: @ Override public synchronized int decompress ( byte [ ] buffer , int off , int len ) throws IOException { SnappyUtil . validateBuffer ( buffer , off , len ) ; if ( inputBuffer . position ( ) == 0 && ! outputBuffer . hasRemaining ( ) ) { return 0 ; } if ( ! outputBuffer . hasRemaining ( ) ) { inputBuffer . rewind ( ) ; Preconditions . checkArgument ( inputBuffer . position ( ) == 0 , "Invalid position of 0." ) ; Preconditions . checkArgument ( outputBuffer . position ( ) == 0 , "Invalid position of 0." ) ; // There is compressed input, decompress it now. int decompressedSize = Snappy . uncompressedLength ( inputBuffer ) ; if ( decompressedSize > outputBuffer . capacity ( ) ) { ByteBuffer oldBuffer = outputBuffer ; outputBuffer = ByteBuffer . allocateDirect ( decompressedSize ) ; CleanUtil . clean ( oldBuffer ) ; } // Reset the previous outputBuffer (i.e. set position to 0) outputBuffer . clear ( ) ; int size = Snappy . uncompress ( inputBuffer , outputBuffer ) ; outputBuffer . limit ( size ) ; // We've decompressed the entire input, reset the input now inputBuffer . clear ( ) ; inputBuffer . limit ( 0 ) ; finished = true ; } // Return compressed output up to 'len' int numBytes = Math . <mask> ( len , outputBuffer . remaining ( ) ) ; outputBuffer . get ( buffer , off , numBytes ) ; return numBytes ; }