Class ZipHelper

    • Method Detail

      • getCorePropertiesZipEntry

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

        public static String getOPCNameFromZipItemName​(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 String getZipItemNameFromOPCName​(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 URI getZipURIFromOPCName​(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.
      • openZipFile

        public static ZipSecureFile openZipFile​(File file)
                                         throws 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:
        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 ZipSecureFile openZipFile​(String path)
                                         throws 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:
        IOException