Package net.sf.okapi.filters.openxml
Class OpenXMLFilter
- java.lang.Object
-
- net.sf.okapi.filters.openxml.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.
-
-
Field Summary
-
Fields inherited from interface net.sf.okapi.common.filters.IFilter
SUB_FILTER
-
-
Constructor Summary
Constructors Constructor Description OpenXMLFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the current process.voidclose()Closes the input zip file and completes the filter.IFilterWritercreateFilterWriter()Creates the filter writer for use with this filter.ISkeletonWritercreateSkeletonWriter()Creates the skeleton writer for use with this filter.List<FilterConfiguration>getConfigurations()Gets the list of all predefined configurations for this filter.StringgetDisplayName()Gets the localizable display name of this filter.EncoderManagergetEncoderManager()Gets the EncoderManager object for this filter.StringgetMimeType()Gets the MIME type of the format supported by this filter.StringgetName()Gets the name/identifier of this filter.ConditionalParametersgetParameters()Returns the current IParameters object.booleanhasNext()Returns true if the filter has a next event.Eventnext()Returns the next zip filter event.voidopen(InputStream input)Opens an input stream for filteringvoidopen(URI inputURI)Opens a URI for filteringvoidopen(RawDocument input)Opens a RawDocument for filtering, defaulting to generating the skeletonvoidopen(RawDocument rawDocument, boolean generateSkeleton)Opens a RawDocument for filteringvoidsetFilterConfigurationMapper(IFilterConfigurationMapper filterConfigurationMapper)Sets the filter configuration mapper for this filter.voidsetOptions(LocaleId sourceLanguage, String defaultEncoding, boolean generateSkeleton)Sets language, encoding, and generation options for the filter.voidsetOptions(LocaleId sourceLanguage, LocaleId targetLanguage, String defaultEncoding, boolean generateSkeleton)Sets language, encoding, and generation options for the filter.voidsetParameters(IParameters params)Sets new parameters for this filter.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Method Detail
-
close
public void close()
Closes the input zip file and completes the filter.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIFilter
-
createSkeletonWriter
public ISkeletonWriter createSkeletonWriter()
Creates the skeleton writer for use with this filter. Null return means implies GenericSkeletonWriter.- Specified by:
createSkeletonWriterin interfaceIFilter- Returns:
- the skeleton writer
-
createFilterWriter
public IFilterWriter createFilterWriter()
Creates the filter writer for use with this filter.- Specified by:
createFilterWriterin interfaceIFilter- Returns:
- the filter writer
-
getEncoderManager
public EncoderManager getEncoderManager()
Description copied from interface:IFilterGets the EncoderManager object for this filter. This encoder manager should provided the mappings to the different MIME types used by the filter.- Specified by:
getEncoderManagerin interfaceIFilter- Returns:
- the EncoderManager for this filter.
-
getName
public String getName()
Description copied from interface:IFilterGets the name/identifier of this filter.
-
getDisplayName
public String getDisplayName()
Description copied from interface:IFilterGets the localizable display name of this filter.- Specified by:
getDisplayNamein interfaceIFilter- Returns:
- the localizable display name of this filter.
-
getMimeType
public String getMimeType()
Description copied from interface:IFilterGets the MIME type of the format supported by this filter.- Specified by:
getMimeTypein interfaceIFilter- Returns:
- The MIME type of the format supported by this filter.
-
getConfigurations
public List<FilterConfiguration> getConfigurations()
Description copied from interface:IFilterGets the list of all predefined configurations for this filter.- Specified by:
getConfigurationsin interfaceIFilter- Returns:
- a list of the all predefined configurations for this filter.
-
getParameters
public ConditionalParameters getParameters()
Returns the current IParameters object.- Specified by:
getParametersin interfaceIFilter- Returns:
- the current IParameters object
-
hasNext
public boolean hasNext()
Returns true if the filter has a next event.
-
next
public Event next()
Returns the next zip filter event.
-
open
public void open(RawDocument input)
Opens a RawDocument for filtering, defaulting to generating the skeleton
-
open
public void open(RawDocument rawDocument, boolean generateSkeleton)
Opens a RawDocument for filtering
-
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 formatdefaultEncoding- 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 formattargetLanguage- target language in de-DE formatdefaultEncoding- encoding, such as "UTF-8"generateSkeleton- true if skeleton should be generated
-
setFilterConfigurationMapper
public void setFilterConfigurationMapper(IFilterConfigurationMapper filterConfigurationMapper)
Description copied from interface:IFilterSets 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:
setFilterConfigurationMapperin interfaceIFilter- Parameters:
filterConfigurationMapper- the mapper to set.
-
setParameters
public void setParameters(IParameters params)
Description copied from interface:IFilterSets new parameters for this filter.- Specified by:
setParametersin interfaceIFilter- Parameters:
params- The new parameters to use.
-
-