This class represents a Zip archive. You can ask for the contained entries, or get an input stream for a file entry. The entry is automatically decompressed. This class is thread safe: You can open input streams for arbitrary entries in different threads. @author Jochen Hoenicke @author Artur B
| 62 | * @author Artur Biesiadowski |
| 63 | */ |
| 64 | public class ZipFile implements ZipConstants |
| 65 | { |
| 66 | |
| 67 | /** |
| 68 | * Mode flag to open a zip file for reading. |
| 69 | */ |
| 70 | public static final int OPEN_READ = 0x1; |
| 71 | |
| 72 | /** |
| 73 | * Mode flag to delete a zip file after reading. |
| 74 | */ |
| 75 | public static final int OPEN_DELETE = 0x4; |
| 76 | |
| 77 | /** |
| 78 | * This field isn't defined in the JDK's ZipConstants, but should be. |
| 79 | */ |
| 80 | static final int ENDNRD = 4; |
| 81 | |
| 82 | // Name of this zip file. |
| 83 | private final String name; |
| 84 | |
| 85 | // File from which zip entries are read. |
| 86 | private final RandomReadingFile rrf; |
| 87 | |
| 88 | // The entries of this zip file when initialized and not yet closed. |
| 89 | private Hashtable entries; |
| 90 | |
| 91 | private boolean closed = false; |
| 92 | |
| 93 | |
| 94 | // /** |
| 95 | // * Helper function to open RandomAccessFile and throw the proper |
| 96 | // * ZipException in case opening the file fails. |
| 97 | // * |
| 98 | // * @param name the file name, or null if file is provided |
| 99 | // * |
| 100 | // * @param file the file, or null if name is provided |
| 101 | // * |
| 102 | // * @return the newly open RandomAccessFile, never null |
| 103 | // */ |
| 104 | // private RandomAccessFile openFile(String name, |
| 105 | // File file) |
| 106 | // throws ZipException, IOException |
| 107 | // { |
| 108 | // try |
| 109 | // { |
| 110 | // return |
| 111 | // (name != null) |
| 112 | // ? new RandomAccessFile(name, "r") |
| 113 | // : new RandomAccessFile(file, "r"); |
| 114 | // } |
| 115 | // catch (FileNotFoundException f) |
| 116 | // { |
| 117 | // ZipException ze = new ZipException(f.getMessage()); |
| 118 | // ze.initCause(f); |
| 119 | // throw ze; |
| 120 | // } |
| 121 | // } |
nothing calls this directly
no outgoing calls
no test coverage detected