List of utility methods to do ZipEntry Read
ZipEntry | getNextZipEntry(ZipInputStream in) Reads the next ZIP file entry from the ZipInputStream and positions the stream at the beginning of the entry data. try { return in.getNextEntry(); } catch (Exception ex) { throw new RuntimeException("Failed to get next entry in ZIP-file", ex); |
String | getSimpleName(ZipEntry entry) get Simple Name return getSimpleName(entry.getName());
|
File | getZipEntry(File f, String nameToRead, String fileName) Get an entry from the specified zip file byte[] fileBytes = new byte[1024]; File fileOut = new File(fileName); FileOutputStream outStream = null; FileInputStream fileInputStream = null; ZipInputStream zipInputStream = null; OutputStream out = null; ZipEntry temp; try { ... |
ZipEntry | getZipEntry(final ZipFile zipFile, final CharSequence zippedName) A sane way of retrieving an entry from a ZipFile based on its /-delimited path name. Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (PATH_SEPARATORS.matcher(entry.getName()).replaceAll("/") .equals(PATH_SEPARATORS.matcher(zippedName).replaceAll("/"))) return entry; return null; ... |
ZipEntry | getZipEntry(String name, ZipFile zipFile) get Zip Entry Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); if (entry.getName().endsWith(name)) { return entry; return null; ... |
ZipEntry | getZipEntry(String zipEntryName) Returns ZipEntry which is usable in both Linux and Windows.
return new ZipEntry(zipEntryName.replace(File.separator, "/")); |
Map | getZipEntry(String zipFileLoc) Get File entries and size from a zip file... ZipInputStream zipIn = null; Map<String, Long> entryMap = null; try { zipIn = new ZipInputStream(new FileInputStream(zipFileLoc)); ZipEntry entry = zipIn.getNextEntry(); entryMap = new HashMap<String, Long>(); while (entry != null) { if (!entry.isDirectory()) { ... |
ZipEntry | getZipEntry(ZipFile jarFile, String path) get Zip Entry Enumeration<? extends ZipEntry> entries = jarFile.entries(); String expected = normalizePath(path); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); String test = normalizePath(entry.getName()); if (expected.equals(test)) { return entry; return null; |
ZipEntry | getZipEntry(ZipFile zip, final String name) get Zip Entry final String lcasename = name.toLowerCase(); for (Enumeration<?> itr = zip.entries(); itr.hasMoreElements();) { final ZipEntry zipentry = (ZipEntry) itr.nextElement(); if (zipentry.getName().toLowerCase().equals(lcasename)) { return zipentry; return null; ... |
ZipEntry | getZipEntry(ZipFile zip, String name) get Zip Entry String lcasename = name.toLowerCase(); for (Enumeration<? extends ZipEntry> itr = zip.entries(); itr.hasMoreElements();) { ZipEntry zipentry = itr.nextElement(); String entryName = zipentry.getName().toLowerCase(); if (entryName.equals(lcasename)) { return zipentry; return null; |