Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.poi.openxml4j.opc.internal
Class ZipHelper

    java.lang.Object
      org.apache.poi.openxml4j.opc.internal.ZipHelper

    @Internal
    public final class ZipHelper

extends java.lang.Object

Field Summary
`static int` | `READ_WRITE_FILE_BUFFER_SIZE` Deprecated. in POI 3.16-beta3, not used anymore

Method Summary
`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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### READ_WRITE_FILE_BUFFER_SIZE

    @Deprecated
    @Removal(version="3.18")
    public static final int READ_WRITE_FILE_BUFFER_SIZE

  Deprecated. in POI 3.16-beta3, not used anymore
  Buffer to read data from file. Use big buffer to improve performaces. the InputStream class is reading only 8192 bytes per read call (default value set by sun)

  See Also:
    Constant Field Values

Method Detail

### getCorePropertiesZipEntry

    public static java.util.zip.ZipEntry getCorePropertiesZipEntry(ZipPackage pkg)

  Retrieve the zip entry of the core properties part.

  Throws:
    `OpenXML4JException` - Throws if internal error occurs.

### getContentTypeZipEntry

    public static java.util.zip.ZipEntry getContentTypeZipEntry(ZipPackage pkg)

  Retrieve the Zip entry of the content types part.

### getOPCNameFromZipItemName

    public 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.

  Parameters:
    `zipItemName` - Zip item name to convert.
  Returns:
    An OPC compliant name.

### getZipItemNameFromOPCName

    public 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.

  Parameters:
    `opcItemName` - The OPC item name to convert.
  Returns:
    A zip item name without any leading slashes.

### getZipURIFromOPCName

    public 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.

  Parameters:
    `opcItemName` - The OPC item name to convert.
  Returns:
    A zip URI without any leading slashes.

### verifyZipHeader

    public static void verifyZipHeader(java.io.InputStream stream)
                                throws NotOfficeXmlFileException,
                                       java.io.IOException

  Verifies that the given stream starts with a Zip structure. Warning - this will consume the first few bytes of the stream, you should push-back or reset the stream after use!

  Throws:
    `NotOfficeXmlFileException`
    `java.io.IOException`

### openZipStream

    public static ZipSecureFile.ThresholdInputStream openZipStream(java.io.InputStream stream)
                                                            throws java.io.IOException

  Opens the specified stream as a secure zip

  Parameters:
    `stream` - The stream to open.
  Returns:
    The zip stream freshly open.
  Throws:
    `java.io.IOException`

### openZipFile

    public static java.util.zip.ZipFile openZipFile(java.io.File file)
                                             throws java.io.IOException,
                                                    NotOfficeXmlFileException

  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:
    `java.io.IOException` - if the zip file cannot be opened or closed to read the header signature
    `NotOfficeXmlFileException` - if stream does not start with zip header signature

### openZipFile

    public static java.util.zip.ZipFile openZipFile(java.lang.String path)
                                             throws java.io.IOException

  Retrieve and open as a secure zip file with the specified path.

  Parameters:
    `path` - The file path.
  Returns:
    The zip archive freshly open.
  Throws:
    `java.io.IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2017 The Apache Software Foundation or its licensors, as applicable.