parent
1c4d0d0f57
commit
6b5e3c5def
@ -235,17 +235,13 @@ public class JdkZlibEncoder extends ZlibEncoder {
|
||||
return future;
|
||||
}
|
||||
|
||||
ByteBuf footer = Unpooled.EMPTY_BUFFER;
|
||||
ByteBuf footer = Unpooled.dynamicBuffer();
|
||||
synchronized (deflater) {
|
||||
int numBytes = 0;
|
||||
deflater.finish();
|
||||
if (!deflater.finished()) {
|
||||
numBytes = deflater.deflate(encodeBuf, 0, encodeBuf.length);
|
||||
}
|
||||
int footerSize = gzip ? numBytes + 8 : numBytes;
|
||||
if (footerSize > 0) {
|
||||
footer = Unpooled.buffer(footerSize);
|
||||
while (!deflater.finished()) {
|
||||
int numBytes = deflater.deflate(encodeBuf, 0, encodeBuf.length);
|
||||
footer.writeBytes(encodeBuf, 0, numBytes);
|
||||
}
|
||||
if (gzip) {
|
||||
int crcValue = (int) crc.getValue();
|
||||
int uncBytes = deflater.getTotalIn();
|
||||
@ -258,7 +254,6 @@ public class JdkZlibEncoder extends ZlibEncoder {
|
||||
footer.writeByte(uncBytes >>> 16);
|
||||
footer.writeByte(uncBytes >>> 24);
|
||||
}
|
||||
}
|
||||
deflater.end();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user