Interface OdfPackage


public interface OdfPackage
An interface defining the behaviour of ODF packages. Most of the methods in this interface concern themselves with the properties of the package needed for validation.
  • Method Details

    • getName

      String getName()
      Get the name or identifier of the package, often the path to the file parsed.
      Returns:
      the String name of the package
    • getDetectedFormat

      Formats getDetectedFormat()
      Get the detected Formats of the package. This is the format detected by format sniffing and may not be the actual ODF type depending on any mimetype zip entry in the package.
      Returns:
      the detected Formats of the package
    • getDetectedVersion

      Version getDetectedVersion()
      Get the detected Version of the package.
    • isWellFormedZip

      boolean isWellFormedZip()
      Is the item parsed a well formed ZipArchive.
      Returns:
      true if the package is well formed, otherwise false
    • getMimeType

      String getMimeType()
      Get the declared mimetype of the package. This is the mimetype declared in the mimetype ZipEntry and/or the manifest's root("/") FileEntry. This may differ from the detected format.
      Returns:
      the declared mimetype of the package
    • hasMimeEntry

      boolean hasMimeEntry()
      Does the package have a mimetype ZipEntry?
      Returns:
      true if the package has a mimetype ZipEntry, otherwise false
    • isMimeFirst

      boolean isMimeFirst()
      Is the mimetype ZipEntry the first ZipEntry in the package?
      Returns:
      true if the mimetype ZipEntry is the first entry in the package's ZipArchive, otherwise false
    • hasManifest

      boolean hasManifest()
      Does the package have a manifest, that is a ZipEntry with the path META-INF/manifest.xml?
      Returns:
      true if the package has a manifest, otherwise false
    • hasThumbnail

      boolean hasThumbnail()
      Does the package have a ZipEntry with the path Thumbnails/thumbnail.png?
      Returns:
      true if the package has a thumbnail preview ZipEntry, otherwise false
    • getZipArchive

      ZipArchive getZipArchive()
      Returns the details of the underlying ZipArchive for the package.
      Returns:
      the package ZipAchive
    • getManifest

      Manifest getManifest()
      Get the Manifest object for the package, this is parsed as long as the META-INF/manifest.xml file exists and is a well formed XML document.
      Returns:
      the package Manifest
    • getEntryXmlStream

      InputStream getEntryXmlStream(String path) throws IOException
      Get the InputStream to any of an identified ODF XML document in the package
      Parameters:
      path - the internal String path to the XML document
      Returns:
      the InputStream to the XML document
      Throws:
      IOException - when there's a problem reading the entry with the supplied path
    • getEntryXmlParseResult

      ParseResult getEntryXmlParseResult(String path)
      Get the XML ParseResult of and identified ODF XML documents in the package
      Parameters:
      path - the internal String package path to the XML document
      Returns:
      the ParseResult returned from parsing the XML document with the supplied path.
      Throws:
      IOException - when there's a problem reading the entry with the supplied path.
    • getXmlEntryPaths

      List<String> getXmlEntryPaths()
      Get a List paths of the package's identified ODF XML documents. These will be all paths to files with the following names:
      • content.xml
      • styles.xml
      • meta.xml
      • settings.xml
      • manifest.rdf
      Returns:
      a List of all of the String internal paths to the packge ODF XML documents
    • getXmlEntries

      Set<FileEntry> getXmlEntries()
      Get the Set of FileEntry to all of the identified ODF XML documents in the package. See getXmlEntryPaths() for the list of XML documents.
      Returns:
      a Set of all of the identified ODF XML documents in the package.
    • getEntryStream

      InputStream getEntryStream(FileEntry entry) throws IOException
      Get the InputStream for any item from the document's Manifest
      Parameters:
      entry - the Manifest FileEntry to get the InputStream for
      Returns:
      the InputStream for the FileEntry supplied
      Throws:
      IOException - when there's a problem reading the FileEntry.
    • getDocument

      OdfPackageDocument getDocument()
      Get the OdfPackageDocument for the package, this is the root document of the ODF Package
      Returns:
      the package's root OdfPackageDocument
    • getDocumentMap

      Map<String,OdfPackageDocument> getDocumentMap()
      Get the Map of the package's OdfPackageDocument objects by String path key.
      Returns:
      the Map of OdfPackageDocument Sub-Documents for the package.
    • getSubDocument

      OdfPackageDocument getSubDocument(String path)
      Get an OdfPackageDocument for a sub-document identified by the passed String path.
      Parameters:
      path - the internal String path to the sub-document
      Returns:
      the OdfPackageDocument for the sub-document
    • getMetaInfMap

      Map<String,ParseResult> getMetaInfMap()
      Retrieve the Map of String path keys and ParseResult values for any ZipEntry below the META-INF directory.
      Returns:
      the Map of META-INF String paths and XML ParseResults.
    • hasDsigEntries

      boolean hasDsigEntries()
      Does the META-INF directory or sub-directories contain a ZipeEntry with the term "signatures" in its name.
      Returns:
      true if the package has Digital Signature entries, otherwise false.
    • isExtended

      boolean isExtended()
      Discover if the file uses any namespaces outside of the ODF specification.
      Returns:
      true if the file uses any namespaces outside of the ODF
    • isEncrypted

      boolean isEncrypted()
      Discover if the package had any encrypted entries.
      Returns:
      true if the package has encrypted entries