add SECURITY

This commit is contained in:
Looly 2021-10-13 01:27:21 +08:00
parent 85bc21b6c1
commit 28fefdeb1b
3 changed files with 30 additions and 4 deletions

15
SECURITY.md Normal file
View File

@ -0,0 +1,15 @@
# Security Policy
## Supported Versions支持的版本
| Version | Supported |
| ------- | ------------------ |
| 5.x.x | :white_check_mark: |
| 4.x.x | :x: |
| 3.x.x | :x: |
## Reporting a Vulnerability报告漏洞
如果你发现有安全问题或漏洞,请发送邮件到`loolly@aliyun.com`。
To report any found security issues or vulnerabilities, please send a mail to `loolly@aliyun.com`.

View File

@ -26,22 +26,22 @@ import java.util.zip.ZipOutputStream;
public class ZipWriter implements Closeable {
/**
* 创建{@link ZipWriter}
* 创建ZipWriter
*
* @param zipFile 生成的Zip文件
* @param charset 编码
* @return {@link ZipWriter}
* @return ZipWriter
*/
public static ZipWriter of(File zipFile, Charset charset) {
return new ZipWriter(zipFile, charset);
}
/**
* 创建{@link ZipWriter}
* 创建ZipWriter
*
* @param out Zip输出的流一般为输出文件流
* @param charset 编码
* @return {@link ZipWriter}
* @return ZipWriter
*/
public static ZipWriter of(OutputStream out, Charset charset) {
return new ZipWriter(out, charset);

View File

@ -1,5 +1,8 @@
package cn.hutool.core.compress;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.resource.FileResource;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ZipUtil;
import org.junit.Ignore;
import org.junit.Test;
@ -13,4 +16,12 @@ public class ZipWriterTest {
public void zipDirTest() {
ZipUtil.zip(new File("d:/test"));
}
@Test
@Ignore
public void addTest(){
final ZipWriter writer = ZipWriter.of(FileUtil.file("d:/test/test.zip"), CharsetUtil.CHARSET_UTF_8);
writer.add(new FileResource("d:/test/qr_c.png"));
writer.close();
}
}