private static @CheckForNull Set<String> members(@CheckForNull FsEntry entry) { return null == entry ? null : entry.getMembers(); }
@Override public long size() { final long size = entry.getSize(DATA); return UNKNOWN == size ? 0 : size; }
@Override public boolean isRegularFile() { return entry.isType(FILE); }
if (null == srcEntry) throw new NoSuchFileException(src.toString()); if (!srcEntry.isType(FILE)) throw new FileSystemException(src.toString(), null, "Expected type FILE, but is " + BitField.copyOf(srcEntry.getTypes()) + "!"); if (null != dstEntry) { if (o.get(EXCLUSIVE)) throw new FileAlreadyExistsException(dst.toString()); if (dstEntry.isType(DIRECTORY)) { try { } catch (IOException ex) { if (!dstEntry.getMembers().isEmpty()) throw (IOException) new DirectoryNotEmptyException(dst.toString()) .initCause(ex);
@Override public FileTime lastModifiedTime() { return FileTime.fromMillis(entry.getTime(WRITE)); }
@Override public FileTime lastAccessTime() { return FileTime.fromMillis(entry.getTime(READ)); }
@Override public boolean isDirectory() { return entry.isType(DIRECTORY); }
@Override public FileTime creationTime() { return FileTime.fromMillis(entry.getTime(CREATE)); }
/** * Returns the names of the members in this (virtual) directory in a newly * created array. * The returned array is <em>not</em> sorted. * This is the most efficient list method. * <p> * <b>Note:</b> Archive entries with absolute paths are ignored by * this method and are never returned. * * @return A possibly empty array with the members of this (virtual) * directory or {@code null} if this instance does not refer to a * (virtual) directory or if the virtual directory is inaccessible * due to an I/O failure. */ @Override public @Nullable String[] list() { if (null != innerArchive) { final FsEntry entry; try { entry = innerArchive.getController().getEntry(getInnerFsEntryName()); } catch (IOException ex) { return null; } if (null == entry) return null; final Set<String> members = entry.getMembers(); return null == members ? null : members.toArray(new String[members.size()]); } return file.list(); }
/** * 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 public long length() { if (null != innerArchive) { final FsEntry entry; try { entry = innerArchive.getController().getEntry(getInnerFsEntryName()); } catch (IOException ex) { return 0; } if (null == entry) return 0; final long size = entry.getSize(Size.DATA); return UNKNOWN != size ? size : 0; } return file.length(); }
@Override public boolean isSymbolicLink() { return entry.isType(SYMLINK); }
/** * 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 public long lastModified() { if (null != innerArchive) { final FsEntry entry; try { entry = innerArchive.getController().getEntry(getInnerFsEntryName()); } catch (IOException ex) { return 0; } if (null == entry) return 0; final long time = entry.getTime(Access.WRITE); return UNKNOWN != time ? time : 0; } return file.lastModified(); }
final FsEntry entry = getEntry(path); final Set<String> set; if (null == entry || null == (set = entry.getMembers())) throw new NotDirectoryException(path.toString());
@Override public boolean isOther() { return entry.isType(SPECIAL); }
/** * 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 public boolean isFile() { if (null != innerArchive) { try { FsEntry entry = innerArchive.getController() .getEntry(getInnerFsEntryName()); return null != entry && entry.isType(FILE); } catch (IOException ex) { return false; } } return file.isFile(); }
/** * 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 public boolean isDirectory() { if (null != innerArchive) { try { FsEntry entry = innerArchive.getController() .getEntry(getInnerFsEntryName()); return null != entry && entry.isType(DIRECTORY); } catch (IOException ex) { return false; } } return file.isDirectory(); }
} catch (IOException ex) { final FsEntry entry = controller.getEntry(innerEntryName); if (null == entry || !entry.isType(DIRECTORY)) throw ex;