parquet-hadoop/src/main/java/org/apache/parquet/hadoop/codec/SnappyDecompressor.java
@Override
  public synchronized void setInput(byte[] buffer, int off, int len) {
    SnappyUtil.validateBuffer(buffer, off, len);

    if (inputBuffer.capacity() - inputBuffer.position() < len) {
      ByteBuffer newBuffer = ByteBuffer.allocateDirect(inputBuffer.position() + len);
      inputBuffer.rewind();
      newBuffer.put(inputBuffer);
      ByteBuffer oldBuffer = inputBuffer;
      inputBuffer = newBuffer;
      CleanUtil.clean(oldBuffer);
    } else {
      inputBuffer.limit(inputBuffer.position() + len);
    }
    inputBuffer.put(buffer, off, len);
  }
@Override
  public synchronized void setInput(byte[] buffer, int off, int len) {
    SnappyUtil.validateBuffer(buffer, off, len);

    if (inputBuffer.capacity() - inputBuffer.position() < len) {
      ByteBuffer newBuffer = ByteBuffer.allocateDirect(inputBuffer.position() + len);
      inputBuffer.rewind();
      newBuffer.put(inputBuffer);
      ByteBuffer oldBuffer = inputBuffer;
      inputBuffer = newBuffer;
      CleanUtil.clean(oldBuffer);
    } else {
      inputBuffer.limit(inputBuffer.position() + len);
    }
    inputBuffer.put(buffer, off, len);
  }
@ Override public synchronized void setInput ( byte [ ] buffer , int off , int len ) { SnappyUtil . validateBuffer ( buffer , off , len ) ; if ( inputBuffer . capacity ( ) - inputBuffer . position ( ) < len ) { ByteBuffer newBuffer = ByteBuffer . allocateDirect ( inputBuffer . position ( ) + len ) ; inputBuffer . rewind ( ) ; newBuffer . put ( inputBuffer ) ; ByteBuffer oldBuffer = inputBuffer ; inputBuffer = newBuffer ; CleanUtil . clean ( oldBuffer ) ; } else { inputBuffer . limit ( inputBuffer . position ( ) + len ) ; } inputBuffer . put ( buffer , off , len ) ; }
Sets input data for decompression.
This should be called if and only if {@link #needsInput()} returns
<code>true</code> indicating that more input data is required.
(Both native and non-native versions of various Decompressors require
that the data passed in via <code>b[]</code> remain unmodified until
the caller is explicitly notified--via {@link #needsInput()}--that the
buffer may be safely modified.  With this requirement, an extra
buffer-copy can be avoided.)

@param buffer   Input data
@param off Start offset
@param len Length
Sets input data for decompression . This should be called if and only if { @link #needsInput () } returns <code > true< / code > indicating that more input data is required . ( Both native and non - native versions of various Decompressors require that the data passed in via <code > b [] < / code > remain unmodified until the caller is explicitly notified -- via { @link #needsInput () } -- that the buffer may be safely modified . With this requirement an extra buffer - copy can be avoided . )