use of org.rx.io.GZIPStream in project rxlib by RockyLOMO.
the class Udp2rawHandler method zip.
private void zip(ByteBuf outBuf, ByteBuf inBuf) {
if (inBuf.readableBytes() < gzipMinLength) {
outBuf.writeByte(1);
outBuf.writeBytes(inBuf);
return;
}
outBuf.writeByte(2);
int w = outBuf.writerIndex();
int unzipLen = inBuf.readableBytes();
try (GZIPStream stream = new GZIPStream(new MemoryStream(outBuf, true), true)) {
stream.write(inBuf);
}
outBuf.readerIndex(0);
log.info("UDP2RAW ZIP {} => {}", unzipLen, outBuf.writerIndex() - w);
}
Aggregations