@Internal public final class ZipHelper extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
READ_WRITE_FILE_BUFFER_SIZE
Deprecated.
in POI 3.16-beta3, not used anymore
|
Modifier and Type | Method and Description |
---|---|
static java.util.zip.ZipEntry |
getContentTypeZipEntry(ZipPackage pkg)
Retrieve the Zip entry of the content types part.
|
static java.util.zip.ZipEntry |
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 java.util.zip.ZipFile |
openZipFile(java.io.File file)
Opens the specified file as a secure zip, or returns null if no
such file exists
|
static java.util.zip.ZipFile |
openZipFile(java.lang.String path)
Retrieve and open as a secure zip file with the specified path.
|
static ZipSecureFile.ThresholdInputStream |
openZipStream(java.io.InputStream stream)
Opens the specified stream as a secure zip
|
static void |
verifyZipHeader(java.io.InputStream stream)
Verifies that the given stream starts with a Zip structure.
|
@Deprecated @Removal(version="3.18") public static final int READ_WRITE_FILE_BUFFER_SIZE
public static java.util.zip.ZipEntry getCorePropertiesZipEntry(ZipPackage pkg)
OpenXML4JException
- Throws if internal error occurs.public static java.util.zip.ZipEntry getContentTypeZipEntry(ZipPackage pkg)
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 void verifyZipHeader(java.io.InputStream stream) throws NotOfficeXmlFileException, java.io.IOException
NotOfficeXmlFileException
java.io.IOException
public static ZipSecureFile.ThresholdInputStream openZipStream(java.io.InputStream stream) throws java.io.IOException
stream
- The stream to open.java.io.IOException
public static java.util.zip.ZipFile 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 java.util.zip.ZipFile openZipFile(java.lang.String path) throws java.io.IOException
path
- The file path.java.io.IOException
Copyright 2018 The Apache Software Foundation or its licensors, as applicable.