Class BrotliDecoder
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.handler.codec.ByteToMessageDecoder
io.netty.handler.codec.compression.BrotliDecoder
- All Implemented Interfaces:
ChannelHandler, ChannelInboundHandler
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class ByteToMessageDecoder
ByteToMessageDecoder.CumulatorNested classes/interfaces inherited from interface ChannelHandler
ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ByteBufprivate com.aayushatharva.brotli4j.decoder.DecoderJNI.Wrapperprivate static final intprivate static final int(package private) static final intprivate booleanprivate final intprivate final intprivate booleanprivate final intprivate booleanFields inherited from class ByteToMessageDecoder
COMPOSITE_CUMULATOR, MERGE_CUMULATOR -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new BrotliDecoder with a default 8kB input bufferBrotliDecoder(int inputBufferSize) Creates a new BrotliDecoderBrotliDecoder(int inputBufferSize, int outputBufferSize) Creates a new BrotliDecoderBrotliDecoder(int inputBufferSize, int outputBufferSize, int defaultMaxForwardBytes) -
Method Summary
Modifier and TypeMethodDescriptionvoidCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline.voidCallsChannelHandlerContext.fireChannelReadComplete()to forward to the nextChannelInboundHandlerin theChannelPipeline.protected voiddecode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) Decode the from oneByteBufto an other.private BrotliDecoder.Statedecompress(ChannelHandlerContext ctx, ByteBuf input) private voiddestroy()private voidprivate voidvoidDo nothing by default, sub-classes may override this method.protected voidGets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.static BrotliDecodernewDecoderWithMaxAllocation(int maxAllocation) Creates a newBrotliDecoderthat use themaxAllocationsemantics: the supplied value bounds the size of the emitted decompressed chunks.private voidpush(int length) private static intreadBytes(ByteBuf in, ByteBuffer dest) Methods inherited from class ByteToMessageDecoder
actualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredMethods inherited from class ChannelInboundHandlerAdapter
channelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtMethods inherited from class ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Field Details
-
DEFAULT_MAX_FORWARD_BYTES
private static final int DEFAULT_MAX_FORWARD_BYTES -
DEFAULT_INPUT_BUFFER_SIZE
private static final int DEFAULT_INPUT_BUFFER_SIZE- See Also:
-
DEFAULT_OUTPUT_BUFFER_SIZE
static final int DEFAULT_OUTPUT_BUFFER_SIZE- See Also:
-
inputBufferSize
private final int inputBufferSize -
outputBufferSize
private final int outputBufferSize -
maxForwardBytes
private final int maxForwardBytes -
decoder
private com.aayushatharva.brotli4j.decoder.DecoderJNI.Wrapper decoder -
destroyed
private boolean destroyed -
needsRead
private boolean needsRead -
pulledSinceLastPush
private boolean pulledSinceLastPush -
accumBuffer
-
-
Constructor Details
-
BrotliDecoder
public BrotliDecoder()Creates a new BrotliDecoder with a default 8kB input buffer -
BrotliDecoder
public BrotliDecoder(int inputBufferSize) Creates a new BrotliDecoder- Parameters:
inputBufferSize- desired size of the input buffer in bytes
-
BrotliDecoder
public BrotliDecoder(int inputBufferSize, int outputBufferSize) Creates a new BrotliDecoder- Parameters:
inputBufferSize- desired size of the input buffer in bytesoutputBufferSize- desired max size of the output buffer in bytes (produce multiple output buffers if exceeded)
-
BrotliDecoder
BrotliDecoder(int inputBufferSize, int outputBufferSize, int defaultMaxForwardBytes)
-
-
Method Details
-
newDecoderWithMaxAllocation
Creates a newBrotliDecoderthat use themaxAllocationsemantics: the supplied value bounds the size of the emitted decompressed chunks. The input buffer size stays at the decoder's default.- Parameters:
maxAllocation- maximum size, in bytes, of each decompressed output buffer forwarded downstream; if0, the decoder's default output cap is used.
-
forwardOutput
-
flushAccumBuffer
-
decompress
-
push
private void push(int length) -
readBytes
-
handlerAdded
Description copied from class:ChannelHandlerAdapterDo nothing by default, sub-classes may override this method.- Specified by:
handlerAddedin interfaceChannelHandler- Overrides:
handlerAddedin classChannelHandlerAdapter- Throws:
Exception
-
decode
Description copied from class:ByteToMessageDecoderDecode the from oneByteBufto an other. This method will be called till either the inputByteBufhas nothing to read when return from this method or till nothing was read from the inputByteBuf.- Specified by:
decodein classByteToMessageDecoder- Parameters:
ctx- theChannelHandlerContextwhich thisByteToMessageDecoderbelongs toin- theByteBuffrom which to read dataout- theListto which decoded messages should be added- Throws:
Exception- is thrown if an error occurs
-
destroy
private void destroy() -
handlerRemoved0
Description copied from class:ByteToMessageDecoderGets called after theByteToMessageDecoderwas removed from the actual context and it doesn't handle events anymore.- Overrides:
handlerRemoved0in classByteToMessageDecoder- Throws:
Exception
-
channelInactive
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelInactivein interfaceChannelInboundHandler- Overrides:
channelInactivein classByteToMessageDecoder- Throws:
Exception
-
channelReadComplete
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelReadComplete()to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelReadCompletein interfaceChannelInboundHandler- Overrides:
channelReadCompletein classByteToMessageDecoder- Throws:
Exception
-