Class LzfDecompressor

    • Method Detail

      • newFactory

        public static Supplier<LzfDecompressor> newFactory()
        Creates a new LZF decompressor factory with the most optimal available methods for underlying data access. It will "unsafe" instance if one can be used on current JVM. It should be safe to call this constructor as implementations are dynamically loaded; however, on some non-standard platforms it may be necessary to use LzfDecompressor(boolean) with true param.
        the factory.
      • newFactory

        public static Supplier<LzfDecompressor> newFactory​(boolean safeInstance)
        Creates a new LZF decompressor factory with specified decoding instance.
        safeInstance - If true decoder will use ChunkDecoder that only uses standard JDK access methods, and should work on all Java platforms and JVMs. Otherwise decoder will try to use highly optimized ChunkDecoder implementation that uses Sun JDK's Unsafe class (which may be included by other JDK's as well).
        the factory.
      • decompress

        public Buffer decompress​(Buffer in,
                                 BufferAllocator allocator)
                          throws DecompressionException
        Description copied from interface: Decompressor
        This method will read from the input Buffer and decompress into a new Buffer that will be allocated (if needed) from the BufferAllocator. If there is not enough readable data in the Buffer to process it will return null. This method should be called in a loop as long:
        • something was read from the input
          something was returned
      • Otherwise this method should be called again once there is more data in the input buffer.
Specified by:
decompress in interface Decompressor
in - the Buffer that contains the data to be decompressed.
allocator - the BufferAllocator that is used to allocate a new buffer (if needed) to write the decompressed bytes too.
the Buffer that contains the decompressed data. The caller of this method takes ownership of the buffer. The return value will be null if there is not enough data readable in the input to make any progress. In this case the user should call it again once there is more data ready to be consumed.
DecompressionException - thrown if an decompression error was encountered or the decompressor was closed before.