Class OpenXMLFilter

  • All Implemented Interfaces:
    AutoCloseable, Iterator<Event>, IFilter

    public class OpenXMLFilter
    extends Object
    implements IFilter

    Filters Microsoft Office Word, Excel, and Powerpoint Documents. OpenXML is the format of these documents.

    Since OpenXML files are Zip files that contain XML documents, this filter handles opening and processing them.

    • Constructor Detail

      • OpenXMLFilter

        public OpenXMLFilter()
    • Method Detail

      • close

        public void close()
        Closes the input zip file and completes the filter.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface IFilter
      • createSkeletonWriter

        public ISkeletonWriter createSkeletonWriter()
        Creates the skeleton writer for use with this filter. Null return means implies GenericSkeletonWriter.
        Specified by:
        createSkeletonWriter in interface IFilter
        Returns:
        the skeleton writer
      • createFilterWriter

        public IFilterWriter createFilterWriter()
        Creates the filter writer for use with this filter.
        Specified by:
        createFilterWriter in interface IFilter
        Returns:
        the filter writer
      • getEncoderManager

        public EncoderManager getEncoderManager()
        Description copied from interface: IFilter
        Gets the EncoderManager object for this filter. This encoder manager should provided the mappings to the different MIME types used by the filter.
        Specified by:
        getEncoderManager in interface IFilter
        Returns:
        the EncoderManager for this filter.
      • getName

        public String getName()
        Description copied from interface: IFilter
        Gets the name/identifier of this filter.
        Specified by:
        getName in interface IFilter
        Returns:
        The name/identifier of the filter.
      • getDisplayName

        public String getDisplayName()
        Description copied from interface: IFilter
        Gets the localizable display name of this filter.
        Specified by:
        getDisplayName in interface IFilter
        Returns:
        the localizable display name of this filter.
      • getMimeType

        public String getMimeType()
        Description copied from interface: IFilter
        Gets the MIME type of the format supported by this filter.
        Specified by:
        getMimeType in interface IFilter
        Returns:
        The MIME type of the format supported by this filter.
      • getConfigurations

        public List<FilterConfiguration> getConfigurations()
        Description copied from interface: IFilter
        Gets the list of all predefined configurations for this filter.
        Specified by:
        getConfigurations in interface IFilter
        Returns:
        a list of the all predefined configurations for this filter.
      • hasNext

        public boolean hasNext()
        Returns true if the filter has a next event.
        Specified by:
        hasNext in interface IFilter
        Specified by:
        hasNext in interface Iterator<Event>
        Returns:
        whether or not the filter has a next event
      • next

        public Event next()
        Returns the next zip filter event.
        Specified by:
        next in interface IFilter
        Specified by:
        next in interface Iterator<Event>
        Returns:
        the next zip filter event
      • open

        public void open​(RawDocument input)
        Opens a RawDocument for filtering, defaulting to generating the skeleton
        Specified by:
        open in interface IFilter
        Parameters:
        input - a Raw Document to open and filter
      • open

        public void open​(RawDocument rawDocument,
                         boolean generateSkeleton)
        Opens a RawDocument for filtering
        Specified by:
        open in interface IFilter
        Parameters:
        rawDocument - a Raw Document to open and filter
        generateSkeleton - true if a skeleton should be generated
      • open

        public void open​(InputStream input)
        Opens an input stream for filtering
        Parameters:
        input - an input stream to open and filter
      • open

        public void open​(URI inputURI)
        Opens a URI for filtering
        Parameters:
        inputURI - cURI to open and filter
      • setOptions

        public void setOptions​(LocaleId sourceLanguage,
                               String defaultEncoding,
                               boolean generateSkeleton)
        Sets language, encoding, and generation options for the filter.
        Parameters:
        sourceLanguage - source language in en-US format
        defaultEncoding - encoding, such as "UTF-8"
        generateSkeleton - true if skeleton should be generated
      • setOptions

        public void setOptions​(LocaleId sourceLanguage,
                               LocaleId targetLanguage,
                               String defaultEncoding,
                               boolean generateSkeleton)
        Sets language, encoding, and generation options for the filter.
        Parameters:
        sourceLanguage - source language in en-US format
        targetLanguage - target language in de-DE format
        defaultEncoding - encoding, such as "UTF-8"
        generateSkeleton - true if skeleton should be generated
      • setFilterConfigurationMapper

        public void setFilterConfigurationMapper​(IFilterConfigurationMapper filterConfigurationMapper)
        Description copied from interface: IFilter
        Sets the filter configuration mapper for this filter. This object is used by this filter if it needs to instantiate sub-filters. The implementations of IFilter that do not use sub-filters can use an empty stub for this method.
        Specified by:
        setFilterConfigurationMapper in interface IFilter
        Parameters:
        filterConfigurationMapper - the mapper to set.
      • setParameters

        public void setParameters​(IParameters params)
        Description copied from interface: IFilter
        Sets new parameters for this filter.
        Specified by:
        setParameters in interface IFilter
        Parameters:
        params - The new parameters to use.
      • cancel

        public void cancel()
        Description copied from interface: IFilter
        Cancels the current process.
        Specified by:
        cancel in interface IFilter