Class OpenXMLFilterWriter

  • All Implemented Interfaces:
    AutoCloseable, net.sf.okapi.common.filterwriter.IFilterWriter

    public class OpenXMLFilterWriter
    extends Object
    implements net.sf.okapi.common.filterwriter.IFilterWriter

    Implements the IFilterWriter interface for the OpenXMLFilter, which 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 writer handles writing out the zip file, and uses OpenXMLContentSkeletonWriter to output the XML documents.

    Version:
    okapi v1.46.0 SV: warning instead of an exception in hangleEvent() SV: added the default clause in handleEvent()
    • Constructor Detail

      • OpenXMLFilterWriter

        public OpenXMLFilterWriter()
        No-arg constructor in case it's needed. Create local factory instances. Be aware - it is strongly encouraged to construct the filter writer with the primary constructor (another one) when an Excel document is going to be filtered, otherwise, there is no chance that the dispersed translations will be correctly initialised. Also, the XML input, output and event factories instantiation will not take into account the relevant class loader.
    • Method Detail

      • cancel

        public void cancel()
        Cancels processing of a filter; yet to be implemented.
        Specified by:
        cancel in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • close

        public void close()
        Closes the zip file.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • getName

        public String getName()
        Gets the name of the filter writer.
        Specified by:
        getName in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • getEncoderManager

        public net.sf.okapi.common.encoder.EncoderManager getEncoderManager()
        Specified by:
        getEncoderManager in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • getSkeletonWriter

        public net.sf.okapi.common.skeleton.ISkeletonWriter getSkeletonWriter()
        Specified by:
        getSkeletonWriter in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • handleEvent

        public net.sf.okapi.common.Event handleEvent​(net.sf.okapi.common.Event event)
        Handles an event. Passes all but START_DOCUMENT, END_DOCUMENT, and DOCUMENT_PART to subdocument processing.
        Specified by:
        handleEvent in interface net.sf.okapi.common.filterwriter.IFilterWriter
        Parameters:
        event - the event to process
      • setOptions

        public void setOptions​(net.sf.okapi.common.LocaleId language,
                               String defaultEncoding)
        Specified by:
        setOptions in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • setOutput

        public void setOutput​(String path)
        Specified by:
        setOutput in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • setOutput

        public void setOutput​(OutputStream output)
        Specified by:
        setOutput in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • setParameters

        public void setParameters​(net.sf.okapi.common.IParameters params)
        Specified by:
        setParameters in interface net.sf.okapi.common.filterwriter.IFilterWriter
      • getParameters

        public net.sf.okapi.filters.openxml.ConditionalParameters getParameters()
        Specified by:
        getParameters in interface net.sf.okapi.common.filterwriter.IFilterWriter