public abstract class AbstractFilter extends java.lang.Object implements IFilter
IFilter
.SUB_FILTER
Constructor and Description |
---|
AbstractFilter()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
addConfiguration(boolean clearAllExisting,
java.lang.String configId,
java.lang.String name,
java.lang.String description,
java.lang.String parametersLocation) |
protected boolean |
addConfiguration(boolean clearAllExisting,
java.lang.String configId,
java.lang.String name,
java.lang.String description,
java.lang.String parametersLocation,
java.lang.String extensions) |
void |
addConfiguration(FilterConfiguration configuration) |
protected boolean |
addConfigurations(java.util.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 |
protected FilterConfiguration |
findConfiguration(java.lang.String configId) |
FilterConfiguration |
getConfiguration(java.lang.String configId) |
java.util.List<FilterConfiguration> |
getConfigurations()
Gets the list of all predefined configurations for this filter.
|
java.lang.String |
getDisplayName()
Gets the localizable display name of this filter.
|
IdGenerator |
getDocumentId() |
java.lang.String |
getDocumentName()
Gets the START_DOCUMENT name for the current input.
|
EncoderManager |
getEncoderManager()
Gets the EncoderManager object for this filter.
|
java.lang.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.
|
java.lang.String |
getMimeType()
Gets the input document mime type.
|
java.lang.String |
getName()
Gets the name/identifier of this filter.
|
java.lang.String |
getNewlineType()
Get the newline type used in the input.
|
IParameters |
getParameters()
Gets the current parameters for this filter.
|
protected <A> A |
getParameters(java.lang.Class<A> expectedClass) |
java.lang.String |
getParametersClassName() |
java.lang.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 boolean |
isUtf8Bom()
Does the input have a UTF-8 Byte Order Mark?
|
protected 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(java.lang.String configId) |
protected void |
setDisplayName(java.lang.String displayName) |
protected void |
setDocumentName(java.lang.String documentName)
Allows implementers to set the START_DOCUMENT name for the current input.
|
protected void |
setEncoding(java.lang.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(java.lang.String mimeType)
Sets the input document mime type.
|
protected void |
setMultilingual(boolean multilingual) |
protected void |
setName(java.lang.String name) |
protected void |
setNewlineType(java.lang.String newlineType)
Sets the newline type.
|
void |
setOptions(LocaleId sourceLocale,
LocaleId targetLocale,
java.lang.String defaultEncoding,
boolean generateSkeleton)
|
void |
setParameters(IParameters params)
Sets new parameters for this filter.
|
void |
setParentId(java.lang.String parentId) |
void |
setSrcLoc(LocaleId srcLoc)
Sets the input document source locale.
|
void |
setTrgLoc(LocaleId trgLoc) |
public IParameters getParameters()
IFilter
getParameters
in interface IFilter
public void setParameters(IParameters params)
IFilter
setParameters
in interface IFilter
params
- The new parameters to use.protected <A> A getParameters(java.lang.Class<A> expectedClass)
public java.lang.String getParametersClassName()
public void setOptions(LocaleId sourceLocale, LocaleId targetLocale, java.lang.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
overridden if a different encoding is detected.generateSkeleton
- - store skeleton (non-translatable parts of the
document) along with the extracted text.protected Event createStartFilterEvent()
Event
StartDocument
event.protected Event createEndFilterEvent()
Event
Ending
event.public FilterConfiguration getConfiguration(java.lang.String configId)
public boolean removeConfiguration(java.lang.String configId)
public java.util.List<FilterConfiguration> getConfigurations()
IFilter
getConfigurations
in interface IFilter
public EncoderManager getEncoderManager()
IFilter
getEncoderManager
in interface IFilter
protected boolean addConfiguration(boolean clearAllExisting, java.lang.String configId, java.lang.String name, java.lang.String description, java.lang.String parametersLocation)
protected boolean addConfiguration(boolean clearAllExisting, java.lang.String configId, java.lang.String name, java.lang.String description, java.lang.String parametersLocation, java.lang.String extensions)
protected boolean addConfigurations(java.util.List<FilterConfiguration> configs)
protected FilterConfiguration findConfiguration(java.lang.String configId)
public void addConfiguration(FilterConfiguration configuration)
public void cancel()
IFilter
public void close()
IFilter
public void open(RawDocument input, boolean generateSkeleton)
IFilter
protected IFilterConfigurationMapper getFilterConfigurationMapper()
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
IFilter
setFilterConfigurationMapper
in interface IFilter
fcMapper
- the mapper to set.public java.lang.String getDocumentName()
protected void setDocumentName(java.lang.String documentName)
documentName
- the input document name or pathpublic java.lang.String getNewlineType()
NewlineType
one of '\n', '\r' or '\r\n'protected void setNewlineType(java.lang.String newlineType)
newlineType
- one of '\n', '\r' or '\r\n'.public java.lang.String getEncoding()
protected void setEncoding(java.lang.String encoding)
encoding
- the new encodingpublic LocaleId getSrcLoc()
public void setSrcLoc(LocaleId srcLoc)
srcLoc
- the new source localepublic LocaleId getTrgLoc()
public void setTrgLoc(LocaleId trgLoc)
trgLoc
- the target locale to setpublic java.lang.String getMimeType()
getMimeType
in interface IFilter
public void setMimeType(java.lang.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()
IFilter
createSkeletonWriter
in interface IFilter
public IFilterWriter createFilterWriter()
IFilter
createFilterWriter
in interface IFilter
public boolean isGenerateSkeleton()
protected void setGenerateSkeleton(boolean generateSkeleton)
generateSkeleton
- the generateSkeleton to setpublic boolean isMultilingual()
protected void setMultilingual(boolean multilingual)
multilingual
- the multilingual to setpublic java.lang.String getName()
IFilter
protected void setName(java.lang.String name)
public java.lang.String getDisplayName()
IFilter
getDisplayName
in interface IFilter
protected void setDisplayName(java.lang.String displayName)
public IdGenerator getDocumentId()
public java.lang.String getParentId()
public void setParentId(java.lang.String parentId)
protected boolean isUtf8Encoding()
protected boolean isUtf8Bom()
Copyright © 2022. All rights reserved.