public void decompress(ByteBuffer @in, ByteBuffer @out) { if (@in.isDirect() && @out.isDirect()) { directDecompress(@in, @out); return; } int inOffset = @in.position(); int uncompressLen = Snappy.uncompress(@in.array(), @in.arrayOffset() + inOffset, @in.limit() - inOffset, @out.array(), @out.arrayOffset() + @out.position()); @out.position(uncompressLen + @out.position()); @out.flip(); }