Use java.util develop a C#.net zip tools

时间:2007-11-2 15:39:31  来源:编程网  作者:asp.net  责任编辑:aspx

{

ZipOutputStream os = new ZipOutputStream(new java.io.FileOutputStream(ZipFileName));

ZipEntry ze = new ZipEntry(FileName);

ze.setMethod(ZipEntry.DEFLATED);

os.putNextEntry(ze);

java.io.FileInputStream fs = new java.io.FileInputStream(string.Concat(FilePath,FileName));

sbyte[] buff = new sbyte[1024];

int n = 0;

while ((n = fs.read(buff, 0, buff.Length)) > 0)

{os.write(buff, 0, n);}

fs.close();

os.closeEntry();

os.close();

}

添加到各大书签: