mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复ZipUtil
中zlib和unZlib调用后资源未释放问题(issue#3976@Github)
This commit is contained in:
@@ -942,7 +942,7 @@ public class ZipUtil {
|
|||||||
*/
|
*/
|
||||||
public static byte[] zlib(final InputStream in, final int level, final int length) {
|
public static byte[] zlib(final InputStream in, final int level, final int length) {
|
||||||
final ByteArrayOutputStream out = new ByteArrayOutputStream(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();
|
return out.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -994,7 +994,7 @@ public class ZipUtil {
|
|||||||
*/
|
*/
|
||||||
public static byte[] unZlib(final InputStream in, final int length) {
|
public static byte[] unZlib(final InputStream in, final int length) {
|
||||||
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
|
final ByteArrayOutputStream out = new ByteArrayOutputStream(length);
|
||||||
Deflate.of(in, out, false).inflater();
|
Deflate.of(in, out, false).inflater().close();
|
||||||
return out.toByteArray();
|
return out.toByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user