Top Description Inners Fields Constructors Methods
io.netty5.handler.codec.compression

public final Class Bzip2Decompressor

extends Object
implements Decompressor
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.compression.Decompressor, java.lang.AutoCloseable
Imports
io.netty5.buffer.Buffer, .BufferAllocator, java.util.function.Supplier

Uncompresses a Buffer encoded with the Bzip2 format. See Bzip2.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum
Bzip2Decompressor.State

Current state of stream.

Field Summary

Modifier and TypeField and Description
private int
blockCRC

The CRC of the current block as read from the block header.

private Bzip2BlockDecompressor
blockDecompressor

The decompressor for the current block.

private int
blockSize

Always: in the range 0 ..

private Bzip2Decompressor.State
private Bzip2HuffmanStageDecoder
huffmanStageDecoder

Bzip2 Huffman coding stage.

private final Bzip2BitReader
reader

A reader that provides bit-level reads.

private int
streamCRC

The merged CRC of all blocks decompressed so far.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
public Buffer
decompress(Buffer
the Buffer that contains the data to be decompressed.
in
,
BufferAllocator
the BufferAllocator that is used to allocate a new buffer (if needed) to write the decompressed bytes too.
allocator
)

Implements io.netty5.handler.codec.compression.Decompressor.decompress.

This method will read from the input Buffer and decompress into a new Buffer that will be allocated (if needed) from the BufferAllocator.
public boolean
isClosed()

Implements io.netty5.handler.codec.compression.Decompressor.isClosed.

Return true if the decompressor was closed, false otherwise.
public boolean
isFinished()

Implements io.netty5.handler.codec.compression.Decompressor.isFinished.

Returns true if and only if the end of the compressed stream has been reached.
public static Supplier<Bzip2Decompressor>

Returns:

a factory.
newFactory
()

Returns a factory for Bzip2Decompressors.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockCRCback to summary
private int blockCRC

The CRC of the current block as read from the block header.

blockDecompressorback to summary
private Bzip2BlockDecompressor blockDecompressor

The decompressor for the current block.

blockSizeback to summary
private int blockSize

Always: in the range 0 .. 9. The current block size is 100000 * this number.

currentStateback to summary
private Bzip2Decompressor.State currentState
huffmanStageDecoderback to summary
private Bzip2HuffmanStageDecoder huffmanStageDecoder

Bzip2 Huffman coding stage.

readerback to summary
private final Bzip2BitReader reader

A reader that provides bit-level reads.

streamCRCback to summary
private int streamCRC

The merged CRC of all blocks decompressed so far.

Constructor Detail

Bzip2Decompressorback to summary
private Bzip2Decompressor()

Method Detail

closeback to summary
public void close()

Implements io.netty5.handler.codec.compression.Decompressor.close.

Doc from io.netty5.handler.codec.compression.Decompressor.close.

Close the decompressor. After this method was called isFinished() will return true as well and it is not allowed to call decompress(Buffer, BufferAllocator) anymore.

Annotations
@Override
decompressback to summary
public Buffer decompress(Buffer in, BufferAllocator allocator) throws DecompressionException

Implements io.netty5.handler.codec.compression.Decompressor.decompress.

Doc from io.netty5.handler.codec.compression.Decompressor.decompress.

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.
    Parameters
    in:Buffer

    the Buffer that contains the data to be decompressed.

    allocator:BufferAllocator

    the BufferAllocator that is used to allocate a new buffer (if needed) to write the decompressed bytes too.

    Returns:Buffer

    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.

    Annotations
    @Override
    Exceptions
    DecompressionException:
    thrown if an decompression error was encountered or the decompressor was closed before.
    isClosedback to summary
    public boolean isClosed()

    Implements io.netty5.handler.codec.compression.Decompressor.isClosed.

    Doc from io.netty5.handler.codec.compression.Decompressor.isClosed.

    Return true if the decompressor was closed, false otherwise.

    Returns:boolean

    if close() was called.

    Annotations
    @Override
    isFinishedback to summary
    public boolean isFinished()

    Implements io.netty5.handler.codec.compression.Decompressor.isFinished.

    Returns true if and only if the end of the compressed stream has been reached.

    Returns:boolean

    Doc from io.netty5.handler.codec.compression.Decompressor.isFinished.

    true if the decompressor is done with decompressing the stream.

    Annotations
    @Override
    newFactoryback to summary
    public static Supplier<Bzip2Decompressor> newFactory()

    Returns a factory for Bzip2Decompressors.

    Returns:Supplier<Bzip2Decompressor>

    a factory.

    io.netty5.handler.codec.compression back to summary

    private final Enum Bzip2Decompressor.State

    extends Enum<Bzip2Decompressor.State>
    Class Inheritance

    Current state of stream.

    Field Summary

    Modifier and TypeField and Description
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State
    public static final Bzip2Decompressor.State

    Constructor Summary

    AccessConstructor and Description
    private

    Method Summary

    Modifier and TypeMethod and Description
    public static Bzip2Decompressor.State
    public static Bzip2Decompressor.State[]
    Inherited from java.lang.Enum:
    clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

    Field Detail

    CLOSEDback to summary
    public static final Bzip2Decompressor.State CLOSED
    DECODE_HUFFMAN_DATAback to summary
    public static final Bzip2Decompressor.State DECODE_HUFFMAN_DATA
    EOFback to summary
    public static final Bzip2Decompressor.State EOF
    INITback to summary
    public static final Bzip2Decompressor.State INIT
    INIT_BLOCKback to summary
    public static final Bzip2Decompressor.State INIT_BLOCK
    INIT_BLOCK_PARAMSback to summary
    public static final Bzip2Decompressor.State INIT_BLOCK_PARAMS
    RECEIVE_HUFFMAN_LENGTHback to summary
    public static final Bzip2Decompressor.State RECEIVE_HUFFMAN_LENGTH
    RECEIVE_HUFFMAN_USED_BITMAPSback to summary
    public static final Bzip2Decompressor.State RECEIVE_HUFFMAN_USED_BITMAPS
    RECEIVE_HUFFMAN_USED_MAPback to summary
    public static final Bzip2Decompressor.State RECEIVE_HUFFMAN_USED_MAP
    RECEIVE_SELECTORSback to summary
    public static final Bzip2Decompressor.State RECEIVE_SELECTORS
    RECEIVE_SELECTORS_NUMBERback to summary
    public static final Bzip2Decompressor.State RECEIVE_SELECTORS_NUMBER

    Constructor Detail

    Stateback to summary
    private State()

    Method Detail

    valueOfback to summary
    public static Bzip2Decompressor.State valueOf(String name)
    valuesback to summary
    public static Bzip2Decompressor.State[] values()