Class LZ4Codec

  • All Implemented Interfaces:
    ICodec

    public class LZ4Codec
    extends AbstractCodec
    Converts byte[] -> byte[] in both directions.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int CODEC_ID
      The gzip codec id.
      protected net.jpountz.lz4.LZ4Compressor compressor  
      protected net.jpountz.lz4.LZ4FastDecompressor decompressor  
      protected static net.jpountz.lz4.LZ4Factory LZ4FACTORY
      Factory for LZ4
    • Constructor Summary

      Constructors 
      Constructor Description
      LZ4Codec()
      Create a new codec.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] decode​(byte[] bytes, int offset, int length)
      Decode bytes.
      byte[] decode​(java.lang.Object bytes)
      Decode an object.
      static byte[] decodeBytes​(net.jpountz.lz4.LZ4FastDecompressor decompressor, byte[] bytes, int offset, int length)
      Decode bytes.
      static byte[] decodeBytes​(net.jpountz.lz4.LZ4FastDecompressor decompressor, java.io.ByteArrayInputStream bais)
      Decode bytes.
      byte[] encode​(byte[] val)
      Encode an object.
      static byte[] encodeBytes​(net.jpountz.lz4.LZ4Compressor compressor, byte[] val)
      Encode an object.
      int getCodecId()
      Get the codec id.
      • Methods inherited from class java.lang.Object

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

      • LZ4FACTORY

        protected static final net.jpountz.lz4.LZ4Factory LZ4FACTORY
        Factory for LZ4
      • compressor

        protected net.jpountz.lz4.LZ4Compressor compressor
      • decompressor

        protected net.jpountz.lz4.LZ4FastDecompressor decompressor
    • Constructor Detail

      • LZ4Codec

        public LZ4Codec()
        Create a new codec.
    • Method Detail

      • getCodecId

        public int getCodecId()
        Get the codec id.
        Returns:
        The codec id.
      • encode

        public byte[] encode​(byte[] val)
        Encode an object.
        Parameters:
        obj - The object.
        Returns:
        The encoded object.
        Throws:
        java.io.IOException
      • decode

        public byte[] decode​(java.lang.Object bytes)
        Decode an object.
        Returns:
        The decoded object.
        Throws:
        java.io.IOException
      • decode

        public byte[] decode​(byte[] bytes,
                             int offset,
                             int length)
        Decode bytes.
        Parameters:
        bytes - The value bytes as byte array or input stream.
        Returns:
        The decoded bytes.
        Throws:
        java.io.IOException
      • encodeBytes

        public static byte[] encodeBytes​(net.jpountz.lz4.LZ4Compressor compressor,
                                         byte[] val)
        Encode an object.
        Parameters:
        obj - The object.
        Throws:
        java.io.IOException
      • decodeBytes

        public static byte[] decodeBytes​(net.jpountz.lz4.LZ4FastDecompressor decompressor,
                                         byte[] bytes,
                                         int offset,
                                         int length)
        Decode bytes.
        Returns:
        The decoded bytes.
        Throws:
        java.io.IOException
      • decodeBytes

        public static byte[] decodeBytes​(net.jpountz.lz4.LZ4FastDecompressor decompressor,
                                         java.io.ByteArrayInputStream bais)
        Decode bytes.
        Returns:
        The decoded bytes.
        Throws:
        java.io.IOException