public IDirectory convertNested() { if (isDirectory()) return convert(); else if (FileSystemImpl.isValidZip(this)) return new NestedZipDirectory(this); else return null; }
public IDirectory convertNested() { if (isDirectory()) return convert(); else if (FileSystemImpl.isValidZip(this)) return new NestedZipDirectory(this); else return null; }
public IDirectory convertNested() { if (isDirectory()) { return convert(); } else { try { return FileSystemImpl.getFSRoot(file, getParent()); } catch (IORuntimeException e) { return null; } } } }
public IFile getFile(String name) { IFile result = null; String entryName = isZipRoot() ? name : getNameInZip() + "/" + name; ZipEntry entryFile = getEntry(entryName); if (entryFile != null) { if (!!!entryFile.isDirectory()) { result = new ZipFileImpl(zip, entryFile, buildParent(entryFile), cache); } else { result = new ZipDirectory(zip, entryFile, buildParent(entryFile), cache); } } return result; }
private ZipEntry getEntry(String entryName) { ZipFile z = openZipFile(); ZipEntry entryFile = null; if (z != null) { entryFile = z.getEntry(entryName); closeZipFile(z); } return entryFile; }
public IFile getFile(String name) { File desiredFile = new File(file, name); IFile result = null; if (desiredFile.exists()) { if(!desiredFile.isDirectory()) result = new FileImpl(desiredFile, rootDirFile); else result = new DirectoryImpl(desiredFile, rootDirFile); } return result; }
/** * This method gets the IDirectory that represents the root of a virtual file * system. The provided file can either identify a directory, or a zip file. * * @param fs the zip file. * @return the root of the virtual FS. */ public static IDirectory getFSRoot(File fs) { return FileSystemImpl.getFSRoot(fs, null); }
public List<IFile> listFiles() { return listFiles(false); }
public List<IFile> listFiles() { return listFiles(false); }
public IDirectory getRoot() { IDirectory root = new DirectoryImpl(rootDirFile, rootDirFile); return root; }
@Override public boolean equals(Object other) { return super.equals(other); }
@Override public int hashCode() { return super.hashCode(); }
public InputStream open() throws IOException { InputStream is = new SpecialZipInputStream(entry); return is; }
public boolean isRoot() { return getParent() == null; }
public ICloseableDirectory toCloseable() { return new CloseableDirectory(this); } }
/** * Constructs a directory in the zip. * * @param zip1 the zip file. * @param entry1 the entry in the zip representing this dir. * @param parent the parent directory. */ public ZipDirectory(File zip1, ZipEntry entry1, ZipDirectory parent, ZipCloseableDirectory cache) { super(zip1, entry1, parent, cache); zipRoot = false; root = parent.getRoot(); }
/** * This method gets an ICloseableDirectory that represents the root of a virtual file * system. The provided InputStream should represent a zip file. * * When this {@link ICloseableDirectory} is closed then backing resources will be * cleaned up. * * @param is An input stream to a zip file. * @return the root of the virtual FS. */ public static ICloseableDirectory getFSRoot(InputStream is) { return FileSystemImpl.getFSRoot(is); } }
public List<IFile> listAllFiles() { return listFiles(true); }
public List<IFile> listAllFiles() { return listFiles(true); }