本文整理汇总了Java中net.jpountz.lz4.LZ4Decompressor类的典型用法代码示例。如果您正苦于以下问题:Java LZ4Decompressor类的具体用法?Java LZ4Decompressor怎么用?Java LZ4Decompressor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LZ4Decompressor类属于net.jpountz.lz4包,在下文中一共展示了LZ4Decompressor类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleModernVersion
import net.jpountz.lz4.LZ4Decompressor; //导入依赖的package包/类
private void handleModernVersion() throws IOException
{
DataOutputStream out = new DataOutputStream(socket.getOutputStream());
out.writeInt(MessagingService.current_version);
out.flush();
DataInputStream in = new DataInputStream(socket.getInputStream());
int maxVersion = in.readInt();
from = CompactEndpointSerializationHelper.deserialize(in);
if (compressed)
{
logger.debug("Upgrading incoming connection to be compressed");
if (version < MessagingService.VERSION_21)
in = new DataInputStream(new SnappyInputStream(socket.getInputStream()));
else
{
LZ4Decompressor decompressor = LZ4Factory.fastestInstance().decompressor();
Checksum checksum = XXHashFactory.fastestInstance().newStreamingHash32(OutboundTcpConnection.LZ4_HASH_SEED).asChecksum();
in = new DataInputStream(new LZ4BlockInputStream(socket.getInputStream(),
decompressor,
checksum));
}
}
else
{
in = new DataInputStream(new BufferedInputStream(socket.getInputStream(), 4096));
}
logger.debug("Max version for {} is {}", from, maxVersion);
if (version > MessagingService.current_version)
{
// save the endpoint so gossip will reconnect to it
Gossiper.instance.addSavedEndpoint(from);
logger.info("Received messages from newer protocol version {}. Ignoring", version);
return;
}
MessagingService.instance().setVersion(from, Math.min(MessagingService.current_version, maxVersion));
logger.debug("set version for {} to {}", from, Math.min(MessagingService.current_version, maxVersion));
// outbound side will reconnect if necessary to upgrade version
while (true)
{
MessagingService.validateMagic(in.readInt());
receiveMessage(in, version);
}
}