java壓縮多個檔案

2021-09-12 18:10:08 字數 514 閱讀 4274

首先建立乙個工具類,定義好介面,這裡的引數

1:filelist:多個檔案的path+name

2:zipfilename:壓縮後的檔名

下面是**,注釋已經很詳細了

public class ziputil 

//構建壓縮檔案file

file zipfile = new file(zipfilename);

//初期化zip流

zipoutputstream out = null;

try//關閉closeentry

out.closeentry();

//關閉fileinputstream

fis.close();}}

}catch (ioexception e) finally catch (ioexception e)

}return zipfilename;

}}

java壓縮多個檔案

首先建立乙個工具類,定義好介面,這裡的引數 1 filelist 多個檔案的path name 2 zipfilename 壓縮後的檔名 下面是 注釋已經很詳細了 public class ziputil 構建壓縮檔案file file zipfile new file zipfilename 初期...

java壓縮多個檔案

首先建立乙個工具類,定義好介面,這裡的引數 1 filelist 多個檔案的path name 2 zipfilename 壓縮後的檔名 下面是 注釋已經很詳細了 public class ziputil 構建壓縮檔案file file zipfile new file zipfilename 初期...

壓縮多個檔案

首先需要icsharpcode.sharpziplib.dll 新建filecompression.cs檔案 using system using system.collections.generic using system.io using system.threading using icsh...