Class InputBufferingDecompressor
- java.lang.Object
-
- io.netty.handler.codec.compression.InputBufferingDecompressor
-
- All Implemented Interfaces:
Decompressor,java.lang.AutoCloseable
- Direct Known Subclasses:
Bzip2Decompressor,FastLzFrameDecompressor,JdkZlibDecompressor,SnappyFrameDecompressor
abstract class InputBufferingDecompressor extends java.lang.Object implements Decompressor
Special decompressor implementation that buffers input so that it can be processed piecemeal, similar toByteToMessageDecoder.
-
-
Nested Class Summary
-
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 ByteBufAllocatorallocatorprivate ByteBufcumulation
-
Constructor Summary
Constructors Constructor Description InputBufferingDecompressor(ByteBufAllocator allocator)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddInput(ByteBuf buf)Add a new input buffer.(package private) intavailable()Number of buffered bytes.voidclose()Close this decompressor, cleaning up any associated resources.(package private) abstract voidprocessInput(ByteBuf buf)Process some input.(package private) abstract ByteBufprocessOutput(ByteBuf buf)Produce some output.ByteBuftakeOutput()Take a decompressed buffer from this decompressor.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.handler.codec.compression.Decompressor
endOfInput, status
-
-
-
-
Field Detail
-
allocator
protected final ByteBufAllocator allocator
-
cumulation
private ByteBuf cumulation
-
-
Constructor Detail
-
InputBufferingDecompressor
InputBufferingDecompressor(ByteBufAllocator allocator)
-
-
Method Detail
-
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
-
processInput
abstract void processInput(ByteBuf buf) throws DecompressionException
Process some input. The input buffer ownership does not transfer to this method: If there's still data unread after this method finishes, it will be buffered.- Parameters:
buf- The input buffer- Throws:
DecompressionException
-
processOutput
abstract ByteBuf processOutput(ByteBuf buf) throws DecompressionException
Produce some output. The input buffer parameter may be read from to consume some more data, but note that this method must return a buffer even if the input is too short.- Parameters:
buf- The input buffer- Throws:
DecompressionException
-
available
final int available()
Number of buffered bytes.- Returns:
- Number of buffered bytes
-
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
-
-