This commit is contained in:
Looly 2021-10-21 22:24:14 +08:00
parent 39df3623e1
commit ce9ee646d6

View File

@ -160,4 +160,24 @@ public class ZipUtilTest {
}
}
@Test
@Ignore
public void zipStreamTest2(){
// https://github.com/dromara/hutool/issues/944
String file1 = "d:/test/a.txt";
String file2 = "d:/test/a.txt";
String file3 = "d:/test/asn1.key";
String zip = "d:/test/test2.zip";
try (OutputStream out = new FileOutputStream(zip)){
//实际应用中, out HttpServletResponse.getOutputStream
ZipUtil.zip(out, Charset.defaultCharset(), false, null,
new File(file1),
new File(file2),
new File(file3)
);
} catch (IOException e) {
throw new IORuntimeException(e);
}
}
}