/** * Creates a new zip entry with fields taken from the specified zip entry. * * <p>Assumes the entry represents a directory if and only if the name ends with a forward slash * "/". * * @param entry the entry to get fields from * @throws ZipException on error */ public ZipArchiveEntry(java.util.zip.ZipEntry entry) throws ZipException { super(entry); setName(entry.getName()); byte[] extra = entry.getExtra(); if (extra != null) { setExtraFields( ExtraFieldUtils.parse(extra, true, ExtraFieldUtils.UnparseableExtraField.READ)); } else { // initializes extra data to an empty byte array setExtra(); } setMethod(entry.getMethod()); this.size = entry.getSize(); }
/** * Creates a new zip entry with the specified name. * * <p>Assumes the entry represents a directory if and only if the name ends with a forward slash * "/". * * @param name the name of the entry */ public ZipArchiveEntry(String name) { super(name); setName(name); }
/** * Sets the name using the raw bytes and the string created from it by guessing or using the * configured encoding. * * @param name the name to use created from the raw bytes using the guessed or configured encoding * @param rawName the bytes originally read as name from the archive * @since 1.2 */ protected void setName(String name, byte[] rawName) { setName(name); this.rawName = rawName; }