ITeye博客

zip解压

tomp110 · 2009-02-11 14:17 · Java · Markdown

private static void extZipFileList(String zipFileName, String extPlace) {
try {

ZipInputStream in = new ZipInputStream(new FileInputStream(
zipFileName));

ZipEntry entry = null;

while ((entry = in.getNextEntry()) != null) {

String entryName = entry.getName();

if (entry.isDirectory()) {
File file = new File(extPlace + entryName);
file.mkdirs();
System.out.println("创建文件夹:" + entryName);
} else {

FileOutputStream os = new FileOutputStream(extPlace

  • entryName);

// Transfer bytes from the ZIP file to the output file
byte buf = new byte;

int len;
while ((len = in.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.close();
in.closeEntry();

}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。