InputStream getInputStream(ZipEntry entry) throws IOException { if (!lockOpen()) { throw new IOException("Failed to open zip file."); //$NON-NLS-1$ } try { InputStream zipStream = zipFile.getInputStream(entry); if (isMruEnabled()) { zipStream = new ZipBundleEntryInputStream(zipStream); } return zipStream; } finally { openLock.unlock(); } }
InputStream getInputStream(ZipEntry entry) throws IOException { if (!lockOpen()) { throw new IOException("Failed to open zip file."); //$NON-NLS-1$ } try { InputStream zipStream = zipFile.getInputStream(entry); if (isMruEnabled()) { zipStream = new ZipBundleEntryInputStream(zipStream); } return zipStream; } finally { openLock.unlock(); } }
public boolean containsDir(String dir) { if (!lockOpen()) { return false;
public boolean containsDir(String dir) { if (!lockOpen()) { return false;
/** * Extracts a directory and all sub content to disk * @param dirName the directory name to extract * @return the File used to extract the content to. A value * of <code>null</code> is returned if the directory to extract does * not exist or if content extraction is not supported. */ File extractDirectory(String dirName) { if (!lockOpen()) { return null; } try { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { String entryPath = entries.nextElement().getName(); if (entryPath.startsWith(dirName) && !entryPath.endsWith("/")) //$NON-NLS-1$ getFile(entryPath, false); } return getExtractFile(dirName); } finally { openLock.unlock(); } }
/** * Extracts a directory and all sub content to disk * @param dirName the directory name to extract * @return the File used to extract the content to. A value * of <code>null</code> is returned if the directory to extract does * not exist or if content extraction is not supported. */ File extractDirectory(String dirName) { if (!lockOpen()) { return null; } try { Enumeration<? extends ZipEntry> entries = zipFile.entries(); while (entries.hasMoreElements()) { String entryPath = entries.nextElement().getName(); if (entryPath.startsWith(dirName) && !entryPath.endsWith("/")) //$NON-NLS-1$ getFile(entryPath, false); } return getExtractFile(dirName); } finally { openLock.unlock(); } }
@Override public Enumeration<String> getEntryPaths(String path, boolean recurse) { if (!lockOpen()) { return null;
@Override public Enumeration<String> getEntryPaths(String path, boolean recurse) { if (!lockOpen()) { return null;
public BundleEntry getEntry(String path) { if (!lockOpen()) { return null; } try { ZipEntry zipEntry = getZipEntry(path); if (zipEntry == null) { if (path.length() == 0 || path.charAt(path.length() - 1) == '/') { // this is a directory request lets see if any entries exist in this directory if (containsDir(path)) return new DirZipBundleEntry(this, path); } return null; } return new ZipBundleEntry(zipEntry, this); } finally { openLock.unlock(); } }
public BundleEntry getEntry(String path) { if (!lockOpen()) { return null; } try { ZipEntry zipEntry = getZipEntry(path); if (zipEntry == null) { if (path.length() == 0 || path.charAt(path.length() - 1) == '/') { // this is a directory request lets see if any entries exist in this directory if (containsDir(path)) return new DirZipBundleEntry(this, path); } return null; } return new ZipBundleEntry(zipEntry, this); } finally { openLock.unlock(); } }
public File getFile(String entry, boolean nativeCode) { if (!lockOpen()) { return null;
public File getFile(String entry, boolean nativeCode) { if (!lockOpen()) { return null;