/** * Shorthand for {@link #getArchiveEntryFile(String)} called with the given entry's path. * * @param entry an entry contained by this archive * @return an AbstractFile that corresponds to the given entry * @throws IOException if neither the entry nor its parent exist within the archive * @throws UnsupportedFileOperationException if {@link FileOperation#READ_FILE} operations are not supported by the * underlying file protocol. */ public AbstractFile getArchiveEntryFile(ArchiveEntry entry) throws IOException, UnsupportedFileOperationException { return getArchiveEntryFile(entry.getPath()); }
/** * This method is overridden to use the archive file's canonical path as the base path of this entry file. */ @Override public String getCanonicalPath() { // Use the archive file's canonical path and append the entry's relative path to it return archiveFile.getCanonicalPath(true)+getRelativeEntryPath(); }
/** * This method is overridden to use the archive file's absolute path as the base path of this entry file. */ @Override public String getAbsolutePath() { // Use the archive file's absolute path and append the entry's relative path to it return archiveFile.getAbsolutePath(true)+getRelativeEntryPath(); }
/** * Delegates to the archive file's {@link AbstractArchiveFile#getEntryInputStream(ArchiveEntry,ArchiveEntryIterator)}} * method. * * @throws UnsupportedFileOperationException if the underlying archive file does not support * {@link FileOperation#READ_FILE} operations. */ @Override public InputStream getInputStream() throws IOException, UnsupportedFileOperationException { return archiveFile.getEntryInputStream(entry, null); }
/** * Adds the given {@link ArchiveEntry} to the entries tree. This method will create the tree if it doesn't already * exist, or re-create it if the archive file has changed since it was last created. * * @param entry the ArchiveEntry to add to the tree * @throws IOException if an error occurred while creating the entries tree * @throws UnsupportedFileOperationException if {@link FileOperation#READ_FILE} operations are not supported by the * underlying file protocol. */ protected void addToEntriesTree(ArchiveEntry entry) throws IOException, UnsupportedFileOperationException { checkEntriesTree(); entryTreeRoot.addArchiveEntry(entry); }
/** * This method is overridden to return the separator of the {@link #getArchiveFile() archive file} that contains * this entry. * * @return the separator of the archive file that contains this entry */ @Override public String getSeparator() { return archiveFile.getSeparator(); }
/** * Checks if the entries tree exists and if this file hasn't been modified since the tree was last created. * If any of those 2 conditions isn't met, the entries tree is (re)created. * * @throws IOException if an error occurred while creating the tree * @throws UnsupportedFileOperationException if {@link FileOperation#READ_FILE} operations are not supported by the * underlying file protocol. */ protected void checkEntriesTree() throws IOException, UnsupportedFileOperationException { if(this.entryTreeRoot==null || getDate()!=this.entryTreeDate) createEntriesTree(); }
/** * This method is overridden to return the archive's root folder. */ @Override public AbstractFile getRoot() { return archiveFile.getRoot(); }
@Override public FilePermissions getPermissions() { // Return the entry's permissions return entry.getPermissions(); }
/** * Delegates to the archive file's {@link AbstractArchiveFile#getFreeSpace()} method. * * @throws IOException if an I/O error occurred * @throws UnsupportedFileOperationException if the underlying archive file does not support * {@link FileOperation#GET_FREE_SPACE} operations. */ @Override public long getFreeSpace() throws IOException, UnsupportedFileOperationException { return archiveFile.getFreeSpace(); }
/** * Delegates to the archive file's {@link AbstractArchiveFile#getTotalSpace()} method. * * @throws IOException if an I/O error occurred * @throws UnsupportedFileOperationException if the underlying archive file does not support * {@link FileOperation#GET_TOTAL_SPACE} operations. */ @Override public long getTotalSpace() throws IOException, UnsupportedFileOperationException { return archiveFile.getTotalSpace(); }
/** * This method is overridden to return the archive's volume folder. */ @Override public AbstractFile getVolume() { return archiveFile.getVolume(); } }
/** * Returns <code>true</code> if this entry exists within the archive file. * * @return true if this entry exists within the archive file */ @Override public boolean exists() { return entry.exists(); }
/** * Declares the entries tree up-to-date by setting the current tree date to the archive file's. * This method should be called by {@link AbstractRWArchiveFile} implementations when the archive file has been * modified and the entries propagated in the tree, to avoid the tree from being automatically re-created when * {@link #checkEntriesTree()} is called. */ protected void declareEntriesTreeUpToDate() { this.entryTreeDate = getDate(); }
@Override public long getSize() { return entry.getSize(); }
@Override public AbstractFile[] ls(FileFilter filter) throws IOException, UnsupportedFileOperationException { return archiveFile.ls(this, null, filter); }
@Override public long getDate() { return entry.getDate(); }
@Override public String getGroup() { return entry.getGroup(); }
@Override public InputStream getInputStream() throws IOException { return archiveFile.getEntryInputStream(entry, iterator); } }