Class SnappyFrameDecompressor
java.lang.Object
io.netty.handler.codec.compression.InputBufferingDecompressor
io.netty.handler.codec.compression.SnappyFrameDecompressor
- All Implemented Interfaces:
Decompressor, AutoCloseable
Uncompresses a
ByteBuf encoded with the Snappy framing format.
See Snappy framing format.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classprivate static enumNested classes/interfaces inherited from interface Decompressor
Decompressor.AbstractDecompressorBuilder, Decompressor.Status -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate intprivate ByteBufprivate final Snappyprivate static final intprivate booleanprivate final booleanFields inherited from class InputBufferingDecompressor
allocator -
Constructor Summary
ConstructorsConstructorDescriptionSnappyFrameDecompressor(SnappyFrameDecompressor.Builder builder, ByteBufAllocator allocator) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()private static voidcheckByte(byte actual, byte expect) voidclose()Close this decompressor, cleaning up any associated resources.voidNotify the decompressor that the end of input has been reached.private static SnappyFrameDecompressor.ChunkTypemapChunkType(byte type) Decodes the chunk type from the type tag byte.(package private) voidprocessInput(ByteBuf in) Process some input.(package private) ByteBufprocessOutput(ByteBuf buf) Produce some output.status()Get the current status.Methods inherited from class InputBufferingDecompressor
addInput, available, takeOutput
-
Field Details
-
SNAPPY_IDENTIFIER_LEN
private static final int SNAPPY_IDENTIFIER_LEN- See Also:
-
MAX_UNCOMPRESSED_DATA_SIZE
private static final int MAX_UNCOMPRESSED_DATA_SIZE- See Also:
-
MIN_UNCOMPRESSED_DATA_SIZE
private static final int MIN_UNCOMPRESSED_DATA_SIZE- See Also:
-
MAX_DECOMPRESSED_DATA_SIZE
private static final int MAX_DECOMPRESSED_DATA_SIZE- See Also:
-
MAX_COMPRESSED_CHUNK_SIZE
private static final int MAX_COMPRESSED_CHUNK_SIZE- See Also:
-
MIN_COMPRESSED_CHUNK_SIZE
private static final int MIN_COMPRESSED_CHUNK_SIZE- See Also:
-
snappy
-
validateChecksums
private final boolean validateChecksums -
started
private boolean started -
numBytesToSkip
private int numBytesToSkip -
pendingOutput
-
eof
private boolean eof
-
-
Constructor Details
-
SnappyFrameDecompressor
SnappyFrameDecompressor(SnappyFrameDecompressor.Builder builder, ByteBufAllocator allocator)
-
-
Method Details
-
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- Overrides:
closein classInputBufferingDecompressor
-
status
Description copied from interface:DecompressorGet the current status. Like the other operations on this class, calling this method is not permitted if the decompressor has failed or was closed.- Returns:
- The current status
- Throws:
DecompressionException
-
endOfInput
Description copied from interface:DecompressorNotify the decompressor that the end of input has been reached. Some implementations may flush remaining data or throw an exception if the input is truncated, but most implementations do nothing. Only permitted forDecompressor.Status.NEED_INPUT.- Throws:
DecompressionException
-
processInput
Description copied from class:InputBufferingDecompressorProcess 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.- Specified by:
processInputin classInputBufferingDecompressor- Parameters:
in- The input buffer- Throws:
DecompressionException
-
processOutput
Description copied from class:InputBufferingDecompressorProduce 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.- Specified by:
processOutputin classInputBufferingDecompressor- Parameters:
buf- The input buffer- Throws:
DecompressionException
-
checkByte
private static void checkByte(byte actual, byte expect) -
mapChunkType
Decodes the chunk type from the type tag byte.- Parameters:
type- The tag byte extracted from the stream- Returns:
- The appropriate
SnappyFrameDecompressor.ChunkType, defaulting toSnappyFrameDecompressor.ChunkType.RESERVED_UNSKIPPABLE
-
builder
-