public class Lz4FrameDecoder extends ByteToMessageDecoder
ByteBuf 。
请参阅原始LZ4 Github project和LZ4 block format以获取完整说明。
由于原始LZ4块格式不包含压缩块的大小和原始数据的大小,因此该编码器使用由Adrien Grand编写并由Yann Collet(原始LZ4库的作者)批准的LZ4 Java库等格式。
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Magic * Token * Compressed * Decompressed * Checksum * * * LZ4压缩* * * *长度*长度* * *块* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
ByteToMessageDecoder.CumulatorChannelHandler.SharableCOMPOSITE_CUMULATOR, MERGE_CUMULATOR| Constructor and Description |
|---|
Lz4FrameDecoder()
创建最快的LZ4解码器。
|
Lz4FrameDecoder(boolean validateChecksums)
用您的机器上最快的解码器实例创建LZ4解码器。
|
Lz4FrameDecoder(LZ4Factory factory, boolean validateChecksums)
用可定制的实现创建一个新的LZ4解码器。
|
Lz4FrameDecoder(LZ4Factory factory, java.util.zip.Checksum checksum)
创建一个新的可定制的LZ4解码器。
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out)
解码从一个 ByteBuf到另一个。
|
boolean |
isClosed()
当且仅当已达到压缩流的结束时才返回
true 。
|
actualReadableBytes, callDecode, channelInactive, channelRead, channelReadComplete, decodeLast, discardSomeReadBytes, handlerRemoved, handlerRemoved0, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggeredchannelActive, channelRegistered, channelUnregistered, channelWritabilityChanged, exceptionCaughtensureNotSharable, handlerAdded, isSharableclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandlerAddedpublic Lz4FrameDecoder()
true的Lz4FrameDecoder(boolean)构造函数。
public Lz4FrameDecoder(boolean validateChecksums)
validateChecksums - 如果true ,校验和字段将根据实际的未压缩数据进行验证,如果校验和不匹配,则会引发合适的DecompressionException
public Lz4FrameDecoder(LZ4Factory factory,
boolean validateChecksums)
factory - 用户可定制的
LZ4Factory实例,它可能是JNI绑定到原始C实现,纯Java实现或使用
Unsafe的Java实现
validateChecksums - 如果true ,校验和字段将根据实际的未压缩数据进行验证,如果校验和不匹配,则会引发合适的DecompressionException 。
在这种情况下,编码器将使用基于Yann Collet在Github处提供的工作的xxhash hashing for Java。
public Lz4FrameDecoder(LZ4Factory factory,
java.util.zip.Checksum checksum)
factory - 用户可定制的
LZ4Factory实例,它可以是JNI绑定到原始C实现,纯Java实现或使用
Unsafe的Java实现
checksum - 用于检查数据完整性的Checksum实例。
如果您不想验证每个块的校验和,则可以设置null
protected void decode(ChannelHandlerContext ctx, ByteBuf in, java.util.List<java.lang.Object> out) throws java.lang.Exception
ByteToMessageDecoder
decode在课程
ByteToMessageDecoder
ctx - ByteToMessageDecoder所属的ChannelHandlerContext
in - 从中读取数据的ByteBuf
out - 应该添加解码消息的
List
java.lang.Exception - 发生错误时抛出
public boolean isClosed()
true if and only if the end of the compressed stream has been reached.
Copyright © 2008–2018 The Netty Project. All rights reserved.