Package net.sf.okapi.filters.openxml
Class OpenXMLFilterWriter
- java.lang.Object
-
- net.sf.okapi.filters.openxml.OpenXMLFilterWriter
-
- All Implemented Interfaces:
AutoCloseable,IFilterWriter
public class OpenXMLFilterWriter extends Object implements 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.
-
-
Constructor Summary
Constructors Constructor Description OpenXMLFilterWriter()No-arg constructor in case it's needed.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels processing of a filter; yet to be implemented.voidclose()Closes the zip file.EncoderManagergetEncoderManager()Gets the current encoder manager for this writer.StringgetName()Gets the name of the filter writer.ConditionalParametersgetParameters()Gets the current parameters for this writer.ISkeletonWritergetSkeletonWriter()Gets the skeleton writer associated with this writer.EventhandleEvent(Event event)Handles an event.voidsetOptions(LocaleId language, String defaultEncoding)Sets the options for this writer.voidsetOutput(OutputStream output)Sets the output through its output stream.voidsetOutput(String path)Sets the output through the path of the output file.voidsetParameters(IParameters params)Sets new parameters for this writer.
-
-
-
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:
cancelin interfaceIFilterWriter
-
close
public void close()
Closes the zip file.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIFilterWriter
-
getName
public String getName()
Gets the name of the filter writer.- Specified by:
getNamein interfaceIFilterWriter- Returns:
- The name of the writer.
-
getEncoderManager
public EncoderManager getEncoderManager()
Description copied from interface:IFilterWriterGets the current encoder manager for this writer. Some special implementation of IFilterWriter may not use an encoder manager (for example writers that do not use skeleton).- Specified by:
getEncoderManagerin interfaceIFilterWriter- Returns:
- the current encoder manager for this writer, or null if none exists for this writer.
-
getSkeletonWriter
public ISkeletonWriter getSkeletonWriter()
Description copied from interface:IFilterWriterGets the skeleton writer associated with this writer. Some implementation of IFilterWriter may not use a skeleton writer.- Specified by:
getSkeletonWriterin interfaceIFilterWriter- Returns:
- the skeleton writer associated with this writer or null if none is associated.
-
handleEvent
public Event handleEvent(Event event)
Handles an event. Passes all but START_DOCUMENT, END_DOCUMENT, and DOCUMENT_PART to subdocument processing.- Specified by:
handleEventin interfaceIFilterWriter- Parameters:
event- the event to process- Returns:
- The event that was processed.
-
setOptions
public void setOptions(LocaleId language, String defaultEncoding)
Description copied from interface:IFilterWriterSets the options for this writer.- Specified by:
setOptionsin interfaceIFilterWriter- Parameters:
language- the output locale.defaultEncoding- Name of the character set encoding for the output.
-
setOutput
public void setOutput(String path)
Description copied from interface:IFilterWriterSets the output through the path of the output file.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
path- Full path of the output file.
-
setOutput
public void setOutput(OutputStream output)
Description copied from interface:IFilterWriterSets the output through its output stream.- Specified by:
setOutputin interfaceIFilterWriter- Parameters:
output- Output stream to use for the output.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilterWriterSets new parameters for this writer.- Specified by:
setParametersin interfaceIFilterWriter- Parameters:
params- The new parameters to use.
-
getParameters
public ConditionalParameters getParameters()
Description copied from interface:IFilterWriterGets the current parameters for this writer.- Specified by:
getParametersin interfaceIFilterWriter- Returns:
- The current parameters for this writer.
-
-