Package net.sf.okapi.filters.openoffice
Class ODFFilter
- java.lang.Object
-
- net.sf.okapi.filters.openoffice.ODFFilter
-
- All Implemented Interfaces:
AutoCloseable,Iterator<Event>,IFilter
public class ODFFilter extends Object implements IFilter
This class implements IFilter for XML documents in Open-Document format (ODF). The expected input is the XML document itself. It can be used on ODF documents that are not in Open-Office.org files (i.e. directly on the content.xml of the .odt). For processing ODT, ODS, etc. documents, use the OpenOfficeFilter class, which calls this filter as needed.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringDOCUMENT_DESCRIPTIONprotected static StringDOCUMENT_SUBJECTprotected static StringDOCUMENT_TITLEprotected static StringMETA_KEYWORDprotected static StringMETA_NAMEprotected static StringMETA_USER_DEFINEDprotected static StringNSURI_TEXTprotected static StringNSURI_XLINKprotected static StringOFFICE_ANNOTATIONprotected static StringPAGE_COUNT_TEXTprotected static StringPAGE_NUMBER_TEXTprotected static StringTEXT_BOOKMARK_REF-
Fields inherited from interface net.sf.okapi.common.filters.IFilter
SUB_FILTER
-
-
Constructor Summary
Constructors Constructor Description ODFFilter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancel()Cancels the current process.voidclose()Closes the input document.IFilterWritercreateFilterWriter()Creates a new IFilterWriter object from the most appropriate class to use with this filter.ISkeletonWritercreateSkeletonWriter()Creates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.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.ParametersgetParameters()Gets the current parameters for this filter.booleanhasNext()Indicates if there is an event to process.Eventnext()Gets the next event available.voidopen(RawDocument input)Opens the input document described in a give RawDocument object.voidopen(RawDocument input, boolean generateSkeleton)Opens the input document described in a give RawDocument object, and optionally creates skeleton information.voidsetContainerMimeType(String mimeType)Sets the MIME type of the file containing this document.voidsetFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)Sets the filter configuration mapper for this filter.voidsetParameters(IParameters newParams)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 net.sf.okapi.common.filters.IFilter
isMultilingual, stream
-
Methods inherited from interface java.util.Iterator
forEachRemaining, remove
-
-
-
-
Field Detail
-
NSURI_TEXT
protected static final String NSURI_TEXT
- See Also:
- Constant Field Values
-
NSURI_XLINK
protected static final String NSURI_XLINK
- See Also:
- Constant Field Values
-
TEXT_BOOKMARK_REF
protected static final String TEXT_BOOKMARK_REF
- See Also:
- Constant Field Values
-
OFFICE_ANNOTATION
protected static final String OFFICE_ANNOTATION
- See Also:
- Constant Field Values
-
DOCUMENT_TITLE
protected static final String DOCUMENT_TITLE
- See Also:
- Constant Field Values
-
DOCUMENT_DESCRIPTION
protected static final String DOCUMENT_DESCRIPTION
- See Also:
- Constant Field Values
-
DOCUMENT_SUBJECT
protected static final String DOCUMENT_SUBJECT
- See Also:
- Constant Field Values
-
META_KEYWORD
protected static final String META_KEYWORD
- See Also:
- Constant Field Values
-
META_USER_DEFINED
protected static final String META_USER_DEFINED
- See Also:
- Constant Field Values
-
META_NAME
protected static final String META_NAME
- See Also:
- Constant Field Values
-
PAGE_NUMBER_TEXT
protected static final String PAGE_NUMBER_TEXT
- See Also:
- Constant Field Values
-
PAGE_COUNT_TEXT
protected static final String PAGE_COUNT_TEXT
- See Also:
- Constant Field Values
-
-
Method Detail
-
close
public void close()
Description copied from interface:IFilterCloses the input document. Developers should call this method from within their code before sending the last event: This can allow writer objects to overwrite the input file when they receive the last event. This method must also be safe to call even if the input document is not opened.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceIFilter
-
cancel
public void cancel()
Description copied from interface:IFilterCancels the current process.
-
hasNext
public boolean hasNext()
Description copied from interface:IFilterIndicates if there is an event to process.Implementer Note: The caller must be able to call this method several times without changing state.
-
open
public void open(RawDocument input)
Description copied from interface:IFilterOpens the input document described in a give RawDocument object. Skeleton information is always created when you use this method.
-
open
public void open(RawDocument input, boolean generateSkeleton)
Description copied from interface:IFilterOpens the input document described in a give RawDocument object, and optionally creates skeleton information.
-
setContainerMimeType
public void setContainerMimeType(String mimeType)
Sets the MIME type of the file containing this document. This is the MIME type found in the mimetype file of the zip file.- Parameters:
mimeType- the MIME type to set.
-
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.
-
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.
-
getParameters
public Parameters getParameters()
Description copied from interface:IFilterGets the current parameters for this filter.- Specified by:
getParametersin interfaceIFilter- Returns:
- The current parameters for this filter, or
DefaultParametersif this filter has no parameters.
-
next
public Event next()
Description copied from interface:IFilterGets the next event available. Calling this method can be done only once on each event.
-
setFilterConfigurationMapper
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
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:
fcMapper- the mapper to set.
-
setParameters
public void setParameters(IParameters newParams)
Description copied from interface:IFilterSets new parameters for this filter.- Specified by:
setParametersin interfaceIFilter- Parameters:
newParams- The new parameters to use.
-
createSkeletonWriter
public ISkeletonWriter createSkeletonWriter()
Description copied from interface:IFilterCreates a new ISkeletonWriter object that corresponds to the type of skeleton this filter uses.- Specified by:
createSkeletonWriterin interfaceIFilter- Returns:
- A new instance of ISkeletonWriter for the type of skeleton this filter uses.
-
createFilterWriter
public IFilterWriter createFilterWriter()
Description copied from interface:IFilterCreates a new IFilterWriter object from the most appropriate class to use with this filter.- Specified by:
createFilterWriterin interfaceIFilter- Returns:
- A new instance of IFilterWriter for the preferred implementation for this filter.
-
-