public abstract class AbstractFilter extends Object implements IFilter
IFilter.SUB_FILTER| Constructor and Description |
|---|
AbstractFilter()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConfiguration(FilterConfiguration configuration) |
boolean |
addConfigurations(List<FilterConfiguration> configs) |
void |
cancel()
Cancels the current process.
|
void |
close()
Closes the input document.
|
protected Event |
createEndFilterEvent()
create a END_DOCUMENT
Event |
IFilterWriter |
createFilterWriter()
Creates a new IFilterWriter object from the most appropriate class to
use with this filter.
|
ISkeletonWriter |
createSkeletonWriter()
Creates a new ISkeletonWriter object that corresponds to the type of skeleton
this filter uses.
|
protected Event |
createStartFilterEvent()
create a START_DOCUMENT
Event |
FilterConfiguration |
getConfiguration(String configId) |
List<FilterConfiguration> |
getConfigurations()
Gets the list of all predefined configurations for this filter.
|
String |
getDisplayName()
Gets the localizable display name of this filter.
|
IdGenerator |
getDocumentId() |
String |
getDocumentName()
Gets the START_DOCUMENT name for the current input.
|
EncoderManager |
getEncoderManager()
Gets the EncoderManager object for this filter.
|
String |
getEncoding()
Gets the input document encoding.
|
protected IFilterConfigurationMapper |
getFilterConfigurationMapper()
Gets the filter configuration mapper if available.
|
IFilterWriter |
getFilterWriter()
Gets the filter writer for this filter.
|
String |
getMimeType()
Gets the input document mime type.
|
String |
getName()
Gets the name/identifier of this filter.
|
String |
getNewlineType()
Get the newline type used in the input.
|
String |
getParentId() |
LocaleId |
getSrcLoc()
Gets the input document source locale.
|
LocaleId |
getTrgLoc() |
boolean |
isCanceled()
Checks if the
IFilter has been canceled. |
boolean |
isGenerateSkeleton() |
boolean |
isMultilingual() |
protected abstract boolean |
isUtf8Bom()
Does the input have a UTF-8 Byte Order Mark?
|
protected abstract boolean |
isUtf8Encoding()
Is the input encoded as UTF-8?
|
void |
open(RawDocument input,
boolean generateSkeleton)
Opens the input document described in a give RawDocument object, and
optionally creates skeleton information.
|
boolean |
removeConfiguration(String configId) |
protected void |
setDisplayName(String displayName) |
protected void |
setDocumentName(String documentName)
Allows implementers to set the START_DOCUMENT name for the current input.
|
protected void |
setEncoding(String encoding)
Sets the input document encoding.
|
void |
setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
Sets the filter configuration mapper for this filter.
|
void |
setFilterWriter(IFilterWriter filterWriter)
Sets the filter writer for this filter.
|
protected void |
setGenerateSkeleton(boolean generateSkeleton) |
void |
setMimeType(String mimeType)
Sets the input document mime type.
|
protected void |
setMultilingual(boolean multilingual) |
protected void |
setName(String name) |
protected void |
setNewlineType(String newlineType)
Sets the newline type.
|
void |
setOptions(LocaleId sourceLocale,
LocaleId targetLocale,
String defaultEncoding,
boolean generateSkeleton)
|
void |
setParentId(String parentId) |
void |
setSrcLoc(LocaleId srcLoc)
Sets the input document source locale.
|
void |
setTrgLoc(LocaleId trgLoc) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetParameters, hasNext, next, open, setParameters, streamforEachRemaining, removepublic void setOptions(LocaleId sourceLocale, LocaleId targetLocale, String defaultEncoding, boolean generateSkeleton)
IFilter has a small set of options beyond normal configuration that gives the
IFilter the needed information to properly parse the content.sourceLocale - - source locale of the input documenttargetLocale - - target locale if the input document is multilingual.defaultEncoding - - assumed encoding of the input document. May be overriden if a different encoding
is detected.generateSkeleton - - store skeleton (non-translatable parts of the document) along with the extracted
text.protected Event createStartFilterEvent()
EventStartDocument event.protected Event createEndFilterEvent()
EventEnding event.public boolean addConfigurations(List<FilterConfiguration> configs)
public FilterConfiguration getConfiguration(String configId)
public boolean removeConfiguration(String configId)
public List<FilterConfiguration> getConfigurations()
IFiltergetConfigurations in interface IFilterpublic void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
IFiltersetFilterConfigurationMapper in interface IFilterfcMapper - the mapper to set.public EncoderManager getEncoderManager()
IFiltergetEncoderManager in interface IFilterpublic void addConfiguration(FilterConfiguration configuration)
public void cancel()
IFilterpublic void close()
IFilterclose in interface AutoCloseableclose in interface IFilterpublic void open(RawDocument input, boolean generateSkeleton)
IFilterprotected IFilterConfigurationMapper getFilterConfigurationMapper()
protected void setDocumentName(String documentName)
documentName - the input document name or pathpublic String getDocumentName()
public String getNewlineType()
NewlineType one of '\n', '\r' or '\r\n'protected void setNewlineType(String newlineType)
newlineType - one of '\n', '\r' or '\r\n'.public String getEncoding()
protected void setEncoding(String encoding)
encoding - the new encodingpublic LocaleId getSrcLoc()
public void setSrcLoc(LocaleId srcLoc)
srcLoc - the new source localepublic void setTrgLoc(LocaleId trgLoc)
trgLoc - the target locale to setpublic LocaleId getTrgLoc()
public String getMimeType()
getMimeType in interface IFilterpublic void setMimeType(String mimeType)
mimeType - the new mime typepublic boolean isCanceled()
IFilter has been canceled.public IFilterWriter getFilterWriter()
public void setFilterWriter(IFilterWriter filterWriter)
filterWriter - the filter writer to set.public ISkeletonWriter createSkeletonWriter()
IFiltercreateSkeletonWriter in interface IFilterpublic IFilterWriter createFilterWriter()
IFiltercreateFilterWriter in interface IFilterprotected void setGenerateSkeleton(boolean generateSkeleton)
generateSkeleton - the generateSkeleton to setpublic boolean isGenerateSkeleton()
protected abstract boolean isUtf8Encoding()
protected abstract boolean isUtf8Bom()
protected void setMultilingual(boolean multilingual)
multilingual - the multilingual to setpublic boolean isMultilingual()
protected void setName(String name)
public String getName()
IFilterpublic String getDisplayName()
IFiltergetDisplayName in interface IFilterprotected void setDisplayName(String displayName)
public IdGenerator getDocumentId()
public String getParentId()
public void setParentId(String parentId)
Copyright © 2021. All rights reserved.