Home All Groups
lz4-java / net / jpountz / lz4 / LZ4DecompressorWithLength.html /
net.jpountz.lz4

Class LZ4DecompressorWithLength

  • java.lang.Object
    • net.jpountz.lz4.LZ4DecompressorWithLength

  • public class LZ4DecompressorWithLength
    extends java.lang.Object
    Convenience class to decompress data compressed by LZ4CompressorWithLength. This decompressor is NOT compatible with any other compressors in lz4-java or any other lz4 tools. The user does not need to specify the length of the compressed data or original data because the length of the original decompressed data is included in the compressed data.
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      byte[]decompress(byte[] src)
      Convenience method, equivalent to calling decompress(src, 0).
      intdecompress(byte[] src, byte[] dest)
      Convenience method, equivalent to calling decompress(src, 0, dest, 0).
      byte[]decompress(byte[] src, int srcOff)
      Convenience method which returns src[srcOff:] decompressed.
      intdecompress(byte[] src, int srcOff, byte[] dest, int destOff)
      Decompresses src[srcOff:] into dest[destOff:] and returns the number of bytes read from src.
      voiddecompress(java.nio.ByteBuffer src, java.nio.ByteBuffer dest)
      Decompresses src into dest.
      intdecompress(java.nio.ByteBuffer src, int srcOff, java.nio.ByteBuffer dest, int destOff)
      Decompresses src[srcOff:] into dest[destOff:] and returns the number of bytes read from src.
      static intgetDecompressedLength(byte[] src)
      Returns the decompressed length of compressed data in src.
      static intgetDecompressedLength(byte[] src, int srcOff)
      Returns the decompressed length of compressed data in src[srcOff:].
      static intgetDecompressedLength(java.nio.ByteBuffer src)
      Returns the decompressed length of compressed data in src.
      static intgetDecompressedLength(java.nio.ByteBuffer src, int srcOff)
      Returns the decompressed length of compressed data in src[srcOff:].
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LZ4DecompressorWithLength

        public LZ4DecompressorWithLength(LZ4FastDecompressor decompressor)
        Creates a new decompressor to decompress data compressed by LZ4CompressorWithLength.
        Parameters:
        decompressor - decompressor to use
    • Method Detail

      • getDecompressedLength

        public static int getDecompressedLength(byte[] src)
        Returns the decompressed length of compressed data in src.
        Parameters:
        src - the compressed data
        Returns:
        the decompressed length
      • getDecompressedLength

        public static int getDecompressedLength(byte[] src,
                                int srcOff)
        Returns the decompressed length of compressed data in src[srcOff:].
        Parameters:
        src - the compressed data
        srcOff - the start offset in src
        Returns:
        the decompressed length
      • getDecompressedLength

        public static int getDecompressedLength(java.nio.ByteBuffer src)
        Returns the decompressed length of compressed data in src.
        Parameters:
        src - the compressed data
        Returns:
        the decompressed length
      • getDecompressedLength

        public static int getDecompressedLength(java.nio.ByteBuffer src,
                                int srcOff)
        Returns the decompressed length of compressed data in src[srcOff:].
        Parameters:
        src - the compressed data
        srcOff - the start offset in src
        Returns:
        the decompressed length
      • decompress

        public int decompress(byte[] src,
                     byte[] dest)
        Convenience method, equivalent to calling decompress(src, 0, dest, 0).
        Parameters:
        src - the compressed data
        dest - the destination buffer to store the decompressed data
        Returns:
        the number of bytes read to restore the original input
      • decompress

        public int decompress(byte[] src,
                     int srcOff,
                     byte[] dest,
                     int destOff)
        Decompresses src[srcOff:] into dest[destOff:] and returns the number of bytes read from src.
        Parameters:
        src - the compressed data
        srcOff - the start offset in src
        dest - the destination buffer to store the decompressed data
        destOff - the start offset in dest
        Returns:
        the number of bytes read to restore the original input
      • decompress

        public byte[] decompress(byte[] src)
        Convenience method, equivalent to calling decompress(src, 0).
        Parameters:
        src - the compressed data
        Returns:
        the decompressed data
      • decompress

        public byte[] decompress(byte[] src,
                        int srcOff)
        Convenience method which returns src[srcOff:] decompressed.

        Warning: this method has an important overhead due to the fact that it needs to allocate a buffer to decompress into.

        Parameters:
        src - the compressed data
        srcOff - the start offset in src
        Returns:
        the decompressed data
      • decompress

        public void decompress(java.nio.ByteBuffer src,
                      java.nio.ByteBuffer dest)
        Decompresses src into dest. This method moves the positions of the buffers.
        Parameters:
        src - the compressed data
        dest - the destination buffer to store the decompressed data
      • decompress

        public int decompress(java.nio.ByteBuffer src,
                     int srcOff,
                     java.nio.ByteBuffer dest,
                     int destOff)
        Decompresses src[srcOff:] into dest[destOff:] and returns the number of bytes read from src. The positions and limits of the ByteBuffers remain unchanged.
        Parameters:
        src - the compressed data
        srcOff - the start offset in src
        dest - the destination buffer to store the decompressed data
        destOff - the start offset in dest
        Returns:
        the number of bytes read to restore the original input