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

public final Class BrotliDecompressor

extends Object
implements Decompressor
Class Inheritance
All Implemented Interfaces
io.netty5.handler.codec.compression.Decompressor, java.lang.AutoCloseable
Imports
com.aayushatharva.brotli4j.decoder.DecoderJNI, io.netty5.buffer.Buffer, .BufferAllocator, io.netty5.util.internal.ObjectUtil, java.io.IOException, java.nio.ByteBuffer, java.util.function.Supplier

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final DecoderJNI.Wrapper
private BrotliDecompressor.State

Constructor Summary

AccessConstructor and Description
private
BrotliDecompressor(int
desired size of the input buffer in bytes
inputBufferSize
)

Creates a new BrotliDecoder

Method Summary

Modifier and TypeMethod and Description
public void
public Buffer
decompress(Buffer
the Buffer that contains the data to be decompressed.
input
,
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 the decompressor was finish.
public static Supplier<BrotliDecompressor>

Returns:

the factory.
newFactory
()

Creates a new factory for BrotliDecompressors with a default 8kB input buffer

public static Supplier<BrotliDecompressor>

Returns:

the factory.
newFactory
(int
desired size of the input buffer in bytes
inputBufferSize
)

Creates a new factory for BrotliDecompressors.

private Buffer
private static int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

decoderback to summary
private final DecoderJNI.Wrapper decoder
stateback to summary
private BrotliDecompressor.State state

Constructor Detail

BrotliDecompressorback to summary
private BrotliDecompressor(int inputBufferSize) throws IOException

Creates a new BrotliDecoder

Parameters
inputBufferSize:int

desired size of the input buffer in bytes

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 input, 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
    input: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.

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

    Returns true if the decompressor was finish. This might be because the decompressor was explicitly closed or the end of the compressed stream was detected.

    Returns:boolean

    true if the decompressor is done with decompressing the stream.

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

    Creates a new factory for BrotliDecompressors with a default 8kB input buffer

    Returns:Supplier<BrotliDecompressor>

    the factory.

    newFactoryback to summary
    public static Supplier<BrotliDecompressor> newFactory(int inputBufferSize)

    Creates a new factory for BrotliDecompressors.

    Parameters
    inputBufferSize:int

    desired size of the input buffer in bytes

    Returns:Supplier<BrotliDecompressor>

    the factory.

    pullback to summary
    private Buffer pull(BufferAllocator alloc)
    readBytesback to summary
    private static int readBytes(Buffer in, ByteBuffer dest)
    io.netty5.handler.codec.compression back to summary

    private final Enum BrotliDecompressor.State

    extends Enum<BrotliDecompressor.State>
    Class Inheritance

    Field Summary

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

    Constructor Summary

    AccessConstructor and Description
    private

    Method Summary

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

    Field Detail

    CLOSEDback to summary
    public static final BrotliDecompressor.State CLOSED
    FINISHEDback to summary
    public static final BrotliDecompressor.State FINISHED
    PROCESSINGback to summary
    public static final BrotliDecompressor.State PROCESSING

    Constructor Detail

    Stateback to summary
    private State()

    Method Detail

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