code: public static int uncompress(ByteBuffer compressed, ByteBuffer uncompressed)
              throws IOException
      {
  
          if (!compressed.isDirect()) {
              throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "input is not a direct buffer");
          }
          if (!uncompressed.isDirect()) {
              throw new SnappyError(SnappyErrorCode.NOT_A_DIRECT_BUFFER, "destination is not a direct buffer");
          }
  
          int cPos = compressed.position();
          int cLen = compressed.remaining();
  
          //         pos  limit
          // [ ......UUUUUU.........]
          int decompressedSize = impl.rawUncompress(compressed, cPos, cLen, uncompressed,
                  uncompressed.position());
          uncompressed.limit(uncompressed.position() + decompressedSize);
  
          return decompressedSize;
      }
docs: Uncompress the content in the input buffer. The result is dumped to the
  specified output buffer.
  <p/>
  Note that if you pass the wrong data or the range [pos(), limit()) that
  cannot be uncompressed, your JVM might crash due to the access violation
  exception issued in the native code written in C++. To avoid this type of
  crash, use {@link #isValidCompressedBuffer(ByteBuffer)} first.
  
  @param compressed buffer[pos() ... limit()) containing the input data
  @param uncompressed output of the the uncompressed data. It uses buffer[pos()..]
  @return uncompressed data size
  @throws IOException when failed to uncompress the given input
  @throws SnappyError when the input is not a direct buffer