jdk提供了Zip相关的类方便的实现压缩和解压缩。使用方法很简单。下边分别是压缩和解压缩的简单事例1,压缩的查看复制到剪切板打印 import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Zip { static final int BUFFER = 2048; public static void main(String argv[]) { try { BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream("E://test//myfiles.zip"); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest)); byte data[] = new byte[BUFFER]; File f = new File("e://test//a//"); File files[] = f.listFiles(); for (int i = 0; i
java unzip string_java实现zip与unzip(引用自java世纪网)
最新推荐文章于 2023-03-27 23:48:12 发布