Class InputBufferingDecompressor
java.lang.Object
io.netty.handler.codec.compression.InputBufferingDecompressor
- All Implemented Interfaces:
Decompressor, AutoCloseable
- Direct Known Subclasses:
Bzip2Decompressor, FastLzFrameDecompressor, JdkZlibDecompressor, SnappyFrameDecompressor
Special decompressor implementation that buffers input so that it can be processed piecemeal, similar to
ByteToMessageDecoder.-
Nested Class Summary
Nested classes/interfaces inherited from interface Decompressor
Decompressor.AbstractDecompressorBuilder, Decompressor.Status -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidAdd a new input buffer.(package private) final intNumber 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.final ByteBufTake a decompressed buffer from this decompressor.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Decompressor
endOfInput, status
-
Field Details
-
allocator
-
cumulation
-
-
Constructor Details
-
InputBufferingDecompressor
InputBufferingDecompressor(ByteBufAllocator allocator)
-
-
Method Details
-
addInput
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
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
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
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 interfaceAutoCloseable- Specified by:
closein interfaceDecompressor
-