java解压缩文件和不解压读取压缩文件中的文本文件内容
java解压缩文件和不解压读取压缩文件中的文本文件内容
解压缩(压缩文件中不带文件夹)
public void unZip(String fileName){
try {
ZipInputStream zis = new ZipInputStream(new FileInputStream(new File(fileName)));
BufferedInputStream bis = new BufferedInputStream(zis);
String outPath = "E:/test";
File outFile = null;
ZipEntry entry = null;
while((entry = zis.getNextEntry())!=null){
outFile = new File(outPath, entry.getName());
FileOutputStream fos = new FileOutputStream(outFile);
BufferedOutputStream bos = new BufferedOutputStream(fos);
int b = 0;
while((b = bis.read())!=-1){
bos.write(b);
}
bos.close();
fos.close();
}
bis.close();
zis.close();
} catch (FileNotFoundException