fix comment

This commit is contained in:
Looly
2021-08-08 22:14:24 +08:00
parent df726654af
commit 26846d0fde
4 changed files with 19 additions and 2 deletions

View File

@@ -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) ?

View File

@@ -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 {

View File

@@ -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<ZipEntry> consumer) throws IORuntimeException {
if (null != this.zipFile) {

View File

@@ -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 {