修复ZipUtil中zlib和unZlib调用后资源未释放问题(issue#3976@Github)

This commit is contained in:
Looly
2025-06-20 10:43:09 +08:00
parent 46249c257f
commit 5919837386
2 changed files with 4 additions and 3 deletions

View File

@@ -926,7 +926,7 @@ public class ZipUtil {
*/
public static byte[] zlib(InputStream in, int level, int length) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
Deflate.of(in, out, false).deflater(level);
Deflate.of(in, out, false).deflater(level).close();
return out.toByteArray();
}
@@ -974,7 +974,7 @@ public class ZipUtil {
*/
public static byte[] unZlib(InputStream in, int length) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
Deflate.of(in, out, false).inflater();
Deflate.of(in, out, false).inflater().close();
return out.toByteArray();
}