MCPcopy Create free account
hub / github.com/ReadyTalk/avian / ZipFile

Method ZipFile

classpath/java/util/zip/ZipFile.java:27–56  ·  view source on GitHub ↗
(String name)

Source from the content-addressed store, hash-verified

25 private final Map<String,Integer> index = new HashMap();
26
27 public ZipFile(String name) throws IOException {
28 file = new RandomAccessFile(name, "r");
29 window = new Window(file, 4096);
30
31 int fileLength = (int) file.length();
32 int pointer = fileLength - 22;
33 byte[] magic = new byte[] { 0x50, 0x4B, 0x05, 0x06 };
34 while (pointer > 0) {
35 if (equal(window.data, window.seek(pointer, magic.length),
36 magic, 0, magic.length))
37 {
38 pointer = directoryOffset(window, pointer);
39
40 magic = new byte[] { 0x50, 0x4B, 0x01, 0x02 };
41 while (pointer < fileLength) {
42 if (equal(window.data, window.seek(pointer, magic.length),
43 magic, 0, magic.length))
44 {
45 index.put(entryName(window, pointer), pointer);
46 pointer = entryEnd(window, pointer);
47 } else {
48 pointer = fileLength;
49 }
50 }
51 pointer = 0;
52 } else {
53 -- pointer;
54 }
55 }
56 }
57
58 public ZipFile(File file) throws IOException {
59 this(file.getAbsolutePath());

Callers

nothing calls this directly

Calls 8

equalMethod · 0.95
directoryOffsetMethod · 0.95
entryNameMethod · 0.95
entryEndMethod · 0.95
getAbsolutePathMethod · 0.80
lengthMethod · 0.65
putMethod · 0.65
seekMethod · 0.45

Tested by

no test coverage detected