Class Lz4FrameDecompressor
- java.lang.Object
-
- io.netty.handler.codec.compression.Lz4FrameDecompressor
-
- All Implemented Interfaces:
Decompressor,java.lang.AutoCloseable
@UnstableApi public final class Lz4FrameDecompressor extends java.lang.Object
Uncompresses aByteBufencoded with the LZ4 format. See original LZ4 Github project and LZ4 block format for full description. Since the original LZ4 block format does not contains size of compressed block and size of original data this encoder uses format like LZ4 Java library written by Adrien Grand and approved by Yann Collet (author of original LZ4 library). * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Magic * Token * Compressed * Decompressed * Checksum * + * LZ4 compressed * * * * length * length * * * block * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLz4FrameDecompressor.Builder-
Nested classes/interfaces inherited from interface io.netty.handler.codec.compression.Decompressor
Decompressor.AbstractDecompressorBuilder, Decompressor.Status
-
-
Field Summary
Fields Modifier and Type Field Description protected ByteBufAllocatorallocator
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddInput(ByteBuf buf)Add a new input buffer.static Lz4FrameDecompressor.Builderbuilder()voidclose()Close this decompressor, cleaning up any associated resources.voidendOfInput()Notify the decompressor that the end of input has been reached.Decompressor.Statusstatus()Get the current status.ByteBuftakeOutput()Take a decompressed buffer from this decompressor.
-
-
-
Field Detail
-
allocator
protected final ByteBufAllocator allocator
-
-
Method Detail
-
status
public Decompressor.Status status() throws DecompressionException
Description copied from interface:DecompressorGet the current status. Like the other operations on this class, calling this method is not permitted if the decompressor has failed or was closed.- Returns:
- The current status
- Throws:
DecompressionException
-
endOfInput
public void endOfInput() throws DecompressionExceptionDescription copied from interface:DecompressorNotify the decompressor that the end of input has been reached. Some implementations may flush remaining data or throw an exception if the input is truncated, but most implementations do nothing. Only permitted forDecompressor.Status.NEED_INPUT.- Throws:
DecompressionException
-
builder
@UnstableApi public static Lz4FrameDecompressor.Builder builder()
-
addInput
public final void addInput(ByteBuf buf) throws DecompressionException
Description copied from interface:DecompressorAdd a new input buffer. Only permitted forDecompressor.Status.NEED_INPUT.- Specified by:
addInputin interfaceDecompressor- Parameters:
buf- The input buffer. Buffer ownership transfers to the decompressor (also on exception).- Throws:
DecompressionException
-
takeOutput
public final ByteBuf takeOutput() throws DecompressionException
Description copied from interface:DecompressorTake a decompressed buffer from this decompressor. Only permitted forDecompressor.Status.NEED_OUTPUT. Buffer ownership transfers to the caller.- Specified by:
takeOutputin interfaceDecompressor- Returns:
- The decompressed buffer. May be empty.
- Throws:
DecompressionException
-
close
public void close()
Description copied from interface:DecompressorClose this decompressor, cleaning up any associated resources. This method is idempotent.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceDecompressor
-
-