Class SnappyFrameDecompressor
- java.lang.Object
-
- io.netty.handler.codec.compression.InputBufferingDecompressor
-
- io.netty.handler.codec.compression.SnappyFrameDecompressor
-
- All Implemented Interfaces:
Decompressor,java.lang.AutoCloseable
@UnstableApi public final class SnappyFrameDecompressor extends InputBufferingDecompressor
Uncompresses aByteBufencoded with the Snappy framing format. See Snappy framing format.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classSnappyFrameDecompressor.Builderprivate static classSnappyFrameDecompressor.ChunkType-
Nested classes/interfaces inherited from interface io.netty.handler.codec.compression.Decompressor
Decompressor.AbstractDecompressorBuilder, Decompressor.Status
-
-
Field Summary
Fields Modifier and Type Field Description private booleaneofprivate static intMAX_COMPRESSED_CHUNK_SIZEprivate static intMAX_DECOMPRESSED_DATA_SIZEprivate static intMAX_UNCOMPRESSED_DATA_SIZEprivate static intMIN_COMPRESSED_CHUNK_SIZEprivate static intMIN_UNCOMPRESSED_DATA_SIZEprivate intnumBytesToSkipprivate ByteBufpendingOutputprivate Snappysnappyprivate static intSNAPPY_IDENTIFIER_LENprivate booleanstartedprivate booleanvalidateChecksums-
Fields inherited from class io.netty.handler.codec.compression.InputBufferingDecompressor
allocator
-
-
Constructor Summary
Constructors Constructor Description SnappyFrameDecompressor(SnappyFrameDecompressor.Builder builder, ByteBufAllocator allocator)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SnappyFrameDecompressor.Builderbuilder()private static voidcheckByte(byte actual, byte expect)voidclose()Close this decompressor, cleaning up any associated resources.voidendOfInput()Notify 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.Decompressor.Statusstatus()Get the current status.-
Methods inherited from class io.netty.handler.codec.compression.InputBufferingDecompressor
addInput, available, takeOutput
-
-
-
-
Field Detail
-
SNAPPY_IDENTIFIER_LEN
private static final int SNAPPY_IDENTIFIER_LEN
- See Also:
- Constant Field Values
-
MAX_UNCOMPRESSED_DATA_SIZE
private static final int MAX_UNCOMPRESSED_DATA_SIZE
- See Also:
- Constant Field Values
-
MIN_UNCOMPRESSED_DATA_SIZE
private static final int MIN_UNCOMPRESSED_DATA_SIZE
- See Also:
- Constant Field Values
-
MAX_DECOMPRESSED_DATA_SIZE
private static final int MAX_DECOMPRESSED_DATA_SIZE
- See Also:
- Constant Field Values
-
MAX_COMPRESSED_CHUNK_SIZE
private static final int MAX_COMPRESSED_CHUNK_SIZE
- See Also:
- Constant Field Values
-
MIN_COMPRESSED_CHUNK_SIZE
private static final int MIN_COMPRESSED_CHUNK_SIZE
- See Also:
- Constant Field Values
-
snappy
private final Snappy snappy
-
validateChecksums
private final boolean validateChecksums
-
started
private boolean started
-
numBytesToSkip
private int numBytesToSkip
-
pendingOutput
private ByteBuf pendingOutput
-
eof
private boolean eof
-
-
Constructor Detail
-
SnappyFrameDecompressor
SnappyFrameDecompressor(SnappyFrameDecompressor.Builder builder, ByteBufAllocator allocator)
-
-
Method Detail
-
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- Overrides:
closein classInputBufferingDecompressor
-
status
public Decompressor.Status status() throws DecompressionException
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
public void endOfInput() throws DecompressionExceptionDescription 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
void processInput(ByteBuf in) throws DecompressionException
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
ByteBuf processOutput(ByteBuf buf) throws DecompressionException
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
private static SnappyFrameDecompressor.ChunkType mapChunkType(byte type)
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
@UnstableApi public static SnappyFrameDecompressor.Builder builder()
-
-