From 26846d0fde63d46c32c2661271c8432af07097ea Mon Sep 17 00:00:00 2001 From: Looly Date: Sun, 8 Aug 2021 22:14:24 +0800 Subject: [PATCH] fix comment --- .../src/main/java/cn/hutool/core/compress/Deflate.java | 4 ++++ .../src/main/java/cn/hutool/core/compress/Gzip.java | 7 ++++++- .../src/main/java/cn/hutool/core/compress/ZipReader.java | 3 +++ .../src/main/java/cn/hutool/core/compress/ZipWriter.java | 7 ++++++- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/hutool-core/src/main/java/cn/hutool/core/compress/Deflate.java b/hutool-core/src/main/java/cn/hutool/core/compress/Deflate.java index f579a17da..4cb1856da 100755 --- a/hutool-core/src/main/java/cn/hutool/core/compress/Deflate.java +++ b/hutool-core/src/main/java/cn/hutool/core/compress/Deflate.java @@ -31,6 +31,7 @@ public class Deflate implements Closeable { * @param source 源流 * @param target 目标流 * @param nowrap {@code true}表示兼容Gzip压缩 + * @return this */ public static Deflate of(InputStream source, OutputStream target, boolean nowrap) { return new Deflate(source, target, nowrap); @@ -62,6 +63,7 @@ public class Deflate implements Closeable { * 将普通数据流压缩 * * @param level 压缩级别,0~9 + * @return this */ public Deflate deflater(int level) { target= (target instanceof DeflaterOutputStream) ? @@ -77,6 +79,8 @@ public class Deflate implements Closeable { /** * 将压缩流解压到target中 + * + * @return this */ public Deflate inflater() { target = (target instanceof InflaterOutputStream) ? diff --git a/hutool-core/src/main/java/cn/hutool/core/compress/Gzip.java b/hutool-core/src/main/java/cn/hutool/core/compress/Gzip.java index 9041e408e..7d76d87ea 100755 --- a/hutool-core/src/main/java/cn/hutool/core/compress/Gzip.java +++ b/hutool-core/src/main/java/cn/hutool/core/compress/Gzip.java @@ -27,6 +27,7 @@ public class Gzip implements Closeable { * * @param source 源流 * @param target 目标流 + * @return Gzip */ public static Gzip of(InputStream source, OutputStream target) { return new Gzip(source, target); @@ -54,13 +55,15 @@ public class Gzip implements Closeable { /** * 将普通数据流压缩 + * + * @return Gzip */ public Gzip gzip() { try { target = (target instanceof GZIPOutputStream) ? (GZIPOutputStream) target : new GZIPOutputStream(target); IoUtil.copy(source, target); - ((GZIPOutputStream)target).finish(); + ((GZIPOutputStream) target).finish(); } catch (IOException e) { throw new IORuntimeException(e); } @@ -69,6 +72,8 @@ public class Gzip implements Closeable { /** * 将压缩流解压到target中 + * + * @return Gzip */ public Gzip unGzip() { try { diff --git a/hutool-core/src/main/java/cn/hutool/core/compress/ZipReader.java b/hutool-core/src/main/java/cn/hutool/core/compress/ZipReader.java index f12f4f194..625324ba0 100755 --- a/hutool-core/src/main/java/cn/hutool/core/compress/ZipReader.java +++ b/hutool-core/src/main/java/cn/hutool/core/compress/ZipReader.java @@ -53,6 +53,7 @@ public class ZipReader implements Closeable { * 构造 * * @param zipFile 读取的的Zip文件 + * @param charset 编码 */ public ZipReader(File zipFile, Charset charset) { this.zipFile = ZipUtil.toZipFile(zipFile, charset); @@ -71,6 +72,7 @@ public class ZipReader implements Closeable { * 构造 * * @param in 读取的的Zip文件流 + * @param charset 编码 */ public ZipReader(InputStream in, Charset charset) { this.in = new ZipInputStream(in, charset); @@ -139,6 +141,7 @@ public class ZipReader implements Closeable { * * @param consumer {@link ZipEntry}处理器 * @throws IORuntimeException IO异常 + * @return this */ public ZipReader read(Consumer consumer) throws IORuntimeException { if (null != this.zipFile) { diff --git a/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java b/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java index a9a86731f..48962fe5f 100755 --- a/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java +++ b/hutool-core/src/main/java/cn/hutool/core/compress/ZipWriter.java @@ -53,6 +53,7 @@ public class ZipWriter implements Closeable { * 构造 * * @param zipFile 生成的Zip文件 + * @param charset 编码 */ public ZipWriter(File zipFile, Charset charset) { this.out = getZipOutputStream(zipFile, charset); @@ -61,7 +62,8 @@ public class ZipWriter implements Closeable { /** * 构造 * - * @param out {@link ZipOutputStream} + * @param out {@link ZipOutputStream} + * @param charset 编码 */ public ZipWriter(OutputStream out, Charset charset) { this.out = getZipOutputStream(out, charset); @@ -113,6 +115,7 @@ public class ZipWriter implements Closeable { * @param withSrcDir 是否包含被打包目录,只针对压缩目录有效。若为false,则只压缩目录下的文件或目录,为true则将本目录也压缩 * @param filter 文件过滤器,通过实现此接口,自定义要过滤的文件(过滤掉哪些文件或文件夹不加入压缩),{@code null}表示不过滤 * @param files 要压缩的源文件或目录。如果压缩一个文件,则为该文件的全路径;如果压缩一个目录,则为该目录的顶层目录路径 + * @return this * @throws IORuntimeException IO异常 * @since 5.1.1 */ @@ -139,6 +142,7 @@ public class ZipWriter implements Closeable { * 添加资源到压缩包,添加后关闭资源流 * * @param resources 需要压缩的资源,资源的路径为{@link Resource#getName()} + * @return this * @throws IORuntimeException IO异常 */ public ZipWriter add(Resource... resources) throws IORuntimeException { @@ -156,6 +160,7 @@ public class ZipWriter implements Closeable { * * @param path 压缩的路径, {@code null}和""表示根目录下 * @param in 需要压缩的输入流,使用完后自动关闭,{@code null}表示加入空目录 + * @return this * @throws IORuntimeException IO异常 */ public ZipWriter add(String path, InputStream in) throws IORuntimeException {