@Override public long size() { final long size = entry.getSize(DATA); return UNKNOWN == size ? 0 : size; }
private long sizeOf(Size type) { return node().getSize(type); }
/** * 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(); }