public final class ZipPackage extends CustomPackage
Represents ZIP archive metadata.
Learn more
The following code snippet shows how to get metadata from a ZIP archive.
Charset charset = Charset.forName("cp866"); try (Metadata metadata = new Metadata(Constants.InputZip)) { ZipRootPackage root = metadata.getRootPackageGeneric(); System.out.println(root.getZipPackage().getComment()); System.out.println(root.getZipPackage().getTotalEntries()); for (ZipFile file : root.getZipPackage().getFiles()) { System.out.println(file.getName()); System.out.println(file.getCompressedSize()); System.out.println(file.getCompressionMethod()); System.out.println(file.getFlags()); System.out.println(file.getModificationDateTime()); System.out.println(file.getUncompressedSize()); // Use a specific encoding for the file names System.out.println(new String(file.getRawName(), charset)); } }
| Modifier and Type | Method and Description |
|---|---|
String |
getComment()
Gets the ZIP archive comment created by a user.
|
ZipFile[] |
getFiles()
Gets an array of
ZipFile entries inside the ZIP archive. |
long |
getTotalEntries()
Gets the total number of entries inside the ZIP archive.
|
void |
setComment(String value)
Sets the ZIP archive comment created by a user.
|
addProperties, contains, findProperties, get_Item, getCount, getKeys, getKnowPropertyDescriptors, getMetadataType, getPropertyDescriptors, iterator, removeProperties, sanitize, setProperties, updatePropertiesclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitforEach, spliteratorpublic final String getComment()
Gets the ZIP archive comment created by a user.
public final ZipFile[] getFiles()
Gets an array of ZipFile entries inside the ZIP archive.
ZipFile entries inside the ZIP archive.public final long getTotalEntries()
Gets the total number of entries inside the ZIP archive.
public final void setComment(String value)
Sets the ZIP archive comment created by a user.
value - The user's comment.Copyright © 2026. All rights reserved.