@Override public @CheckForNull FsNode node( BitField<FsAccessOption> options, FsNodeName name) throws IOException { return controller.node(options, name); }
@Override public final FsNode node(BitField<FsAccessOption> options, FsNodeName name) throws IOException { return controller.node(map(options), name); }
try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (IOException ex) { return null;
FsNode stat(TPath path) throws IOException { return getController().node(path.getAccessPreferences(), path.getNodeName()); }
try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (IOException ex) { return null;
FsNodeAttributes(final TPath path) throws IOException { if (null == (entry = getController() .node(path.getAccessPreferences(), path.getNodeName()))) throw new NoSuchFileException(path.toString()); }
/** * Similar to its super class implementation, but returns * {@code false} for a valid archive file, too. * <p> * For archive file validation its virtual file system gets mounted. * In case a RAES encrypted ZIP file gets mounted, the user gets prompted * for its password unless the default configuration for key management * hasn't been overridden. * * @see <a href="#falsePositives">Detecting Archive Paths and False Positives</a> */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public boolean isFile() { if (null != innerArchive) { try { final FsNode entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); return null != entry && entry.isType(FILE); } catch (IOException ex) { return false; } } return file.isFile(); }
/** * {@inheritDoc} * <p> * Note that archive entries with absolute paths are ignored by this * method and are never returned. */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public @Nullable TFile[] listFiles(final @CheckForNull FileFilter filter) { if (null != innerArchive) { final FsNode entry; try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (IOException ex) { return null; } return filter(members(entry), filter); } else { return filter(list(file.list()), filter); } }
/** * Similar to its super class implementation, but returns * {@code true} for a valid archive file, too. * <p> * For archive file validation its virtual file system gets mounted. * In case a RAES encrypted ZIP file gets mounted, the user gets prompted * for its password unless the default configuration for key management * hasn't been overridden. * * @see <a href="#falsePositives">Detecting Archive Paths and False Positives</a> * @see #isArchive * @see #isEntry */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public boolean isDirectory() { if (null != innerArchive) { try { final FsNode entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); return null != entry && entry.isType(DIRECTORY); } catch (IOException ex) { return false; } } return file.isDirectory(); }
/** * Returns a {@code long} value representing the time this file was * last modified, measured in milliseconds since the epoch (00:00:00 GMT, * January 1, 1970), or {@code 0L} if the file does not exist or if an * I/O error occurs or if this is a ghost directory in an archive file. * * @see <a href="package.html">Package description for more information * about ghost directories</a> */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public long lastModified() { if (null != innerArchive) { final FsNode entry; try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (final IOException ex) { return 0; } if (null == entry) return 0; final long time = entry.getTime(Access.WRITE); return UNKNOWN != time ? time : 0; } return file.lastModified(); }
/** * Returns the (uncompressed) length of the file. * The length returned of a valid archive file is {@code 0} in order * to properly emulate virtual directories across all platforms. * <p> * For archive file validation its virtual file system gets mounted. * In case a RAES encrypted ZIP file gets mounted, the user gets prompted * for its password unless the default configuration for key management * hasn't been overridden. * * @see <a href="#falsePositives">Detecting Archive Paths and False Positives</a> */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public long length() { if (null != innerArchive) { final FsNode entry; try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (final IOException ex) { return 0; } if (null == entry) return 0; final long size = entry.getSize(Size.DATA); return UNKNOWN != size ? size : 0; } return file.length(); }
/** * {@inheritDoc} * <p> * Note that archive entries with absolute paths are ignored by this * method and are never returned. */ @Override @FsAssertion(atomic=YES, consistent=YES, isolated=YES, durable=NOT_APPLICABLE) public @Nullable TFile[] listFiles( final @CheckForNull FilenameFilter filter) { if (null != innerArchive) { final FsNode entry; try { entry = innerArchive.getController() .node(getAccessPreferences(), getNodeName()); } catch (IOException ex) { return null; } return filter(members(entry), filter); } else { return filter(list(file.list(filter)), (FilenameFilter) null); } }
void createDirectory(final TPath path, final FileAttribute<?>... attrs) throws IOException { if (0 < attrs.length) throw new UnsupportedOperationException(); final FsController controller = getController(); final FsNodeName name = path.getNodeName(); final BitField<FsAccessOption> options = path.getAccessPreferences(); try { controller.make( options, name, DIRECTORY, null); } catch (IOException ex) { if (null != controller.node(options, name)) throw (IOException) new FileAlreadyExistsException(path.toString()) .initCause(ex); throw ex; } }
} catch (IOException ex) { final FsNode entry = controller .node(getAccessPreferences(), innerEntryName); if (null == entry || !entry.isType(DIRECTORY)) throw ex;
.get() .controller(DRIVER, mp) .node(FsAccessOptions.NONE, en); } catch (IOException ex) { node = null;
SeekableByteChannel newByteChannel( final TPath path, final Set<? extends OpenOption> options, final FileAttribute<?>... attrs) throws IOException { final FsNodeName name = path.getNodeName(); final FsController controller = getController(); if (options.isEmpty() || options.contains(StandardOpenOption.READ)) { final BitField<FsAccessOption> o = path.inputOptions(options).set(CACHE); return controller .input(o, name) .channel(null); } else { final BitField<FsAccessOption> o = path.outputOptions(options).set(CACHE); try { return controller .output(o, name, null) .channel(null); } catch (final IOException ex) { // TODO: Filter FileAlreadyExistsException. if (o.get(EXCLUSIVE) && null != controller.node(o, name)) throw (IOException) new FileAlreadyExistsException(path.toString()) .initCause(ex); throw ex; } } }