@Internal public final class ZipHelper extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static org.apache.commons.compress.archivers.zip.ZipArchiveEntry |
getCorePropertiesZipEntry(ZipPackage pkg)
Retrieve the zip entry of the core properties part.
|
static java.lang.String |
getOPCNameFromZipItemName(java.lang.String zipItemName)
Convert a zip name into an OPC name by adding a leading forward slash to
the specified item name.
|
static java.lang.String |
getZipItemNameFromOPCName(java.lang.String opcItemName)
Convert an OPC item name into a zip item name by removing any leading
forward slash if it exist.
|
static java.net.URI |
getZipURIFromOPCName(java.lang.String opcItemName)
Convert an OPC item name into a zip URI by removing any leading forward
slash if it exist.
|
static ZipSecureFile |
openZipFile(java.io.File file)
Opens the specified file as a secure zip, or returns null if no
such file exists
|
static ZipSecureFile |
openZipFile(java.lang.String path)
Retrieve and open as a secure zip file with the specified path.
|
static ZipArchiveThresholdInputStream |
openZipStream(java.io.InputStream stream)
Opens the specified stream as a secure zip
|
public static org.apache.commons.compress.archivers.zip.ZipArchiveEntry getCorePropertiesZipEntry(ZipPackage pkg)
java.lang.IllegalArgumentException
- If the relationship for
core properties cannot be read or an invalid name is
specified in the properties.public static java.lang.String getOPCNameFromZipItemName(java.lang.String zipItemName)
zipItemName
- Zip item name to convert.public static java.lang.String getZipItemNameFromOPCName(java.lang.String opcItemName)
opcItemName
- The OPC item name to convert.public static java.net.URI getZipURIFromOPCName(java.lang.String opcItemName)
opcItemName
- The OPC item name to convert.public static ZipArchiveThresholdInputStream openZipStream(java.io.InputStream stream) throws java.io.IOException
stream
- The stream to open.java.io.IOException
public static ZipSecureFile openZipFile(java.io.File file) throws java.io.IOException, NotOfficeXmlFileException
file
- The file to open.java.io.IOException
- if the zip file cannot be opened or closed to read the header signatureNotOfficeXmlFileException
- if stream does not start with zip header signaturepublic static ZipSecureFile openZipFile(java.lang.String path) throws java.io.IOException
path
- The file path.java.io.IOException
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.