Class ZipHelper
java.lang.Object
org.apache.poi.openxml4j.opc.internal.ZipHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.commons.compress.archivers.zip.ZipArchiveEntryRetrieve the zip entry of the core properties part.static StringgetOPCNameFromZipItemName(String zipItemName) Convert a zip name into an OPC name by adding a leading forward slash to the specified item name.static StringgetZipItemNameFromOPCName(String opcItemName) Convert an OPC item name into a zip item name by removing any leading forward slash if it exist.static URIgetZipURIFromOPCName(String opcItemName) Convert an OPC item name into a zip URI by removing any leading forward slash if it exist.static ZipSecureFileopenZipFile(File file) Opens the specified file as a secure zip, or returns null if no such file existsstatic ZipSecureFileopenZipFile(String path) Retrieve and open as a secure zip file with the specified path.openZipStream(InputStream stream) Opens the specified stream as a secure zip
-
Method Details
-
getCorePropertiesZipEntry
public static org.apache.commons.compress.archivers.zip.ZipArchiveEntry getCorePropertiesZipEntry(ZipPackage pkg) Retrieve the zip entry of the core properties part.- Throws:
IllegalArgumentException- If the relationship for core properties cannot be read or an invalid name is specified in the properties.
-
getOPCNameFromZipItemName
Convert a zip name into an OPC name by adding a leading forward slash to the specified item name.- Parameters:
zipItemName- Zip item name to convert.- Returns:
- An OPC compliant name.
-
getZipItemNameFromOPCName
Convert an OPC item name into a zip item name by removing any leading forward slash if it exist.- Parameters:
opcItemName- The OPC item name to convert.- Returns:
- A zip item name without any leading slashes.
-
getZipURIFromOPCName
Convert an OPC item name into a zip URI by removing any leading forward slash if it exist.- Parameters:
opcItemName- The OPC item name to convert.- Returns:
- A zip URI without any leading slashes.
-
openZipStream
Opens the specified stream as a secure zip- Parameters:
stream- The stream to open.- Returns:
- The zip stream freshly open.
- Throws:
IOException
-
openZipFile
Opens the specified file as a secure zip, or returns null if no such file exists- Parameters:
file- The file to open.- Returns:
- The zip archive freshly open.
- Throws:
IOException- if the zip file cannot be opened or closed to read the header signatureNotOfficeXmlFileException- if stream does not start with zip header signature
-
openZipFile
Retrieve and open as a secure zip file with the specified path.- Parameters:
path- The file path.- Returns:
- The zip archive freshly open.
- Throws:
IOException
-