-
Notifications
You must be signed in to change notification settings - Fork 122
/
Main.java
34 lines (31 loc) · 832 Bytes
/
Main.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package io.zip;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
public class Main {
public static void main(String[] args) {
try {
try (
ZipInputStream zip = new ZipInputStream(
new FileInputStream(
"D:\\IdeaProjects\\KongFuOfArchitect\\part3\\java\\liaoxuefengJavaTutorial\\io\\zip\\readme.zip"
)
)
) {
ZipEntry entry = null;
while ((entry = zip.getNextEntry()) != null) {
String name = entry.getName();
if (!entry.isDirectory()) {
int n;
while ((n = zip.read()) != -1) {
System.out.println(n);
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}