public abstract class AbstractFilter extends Object implements IFilter
IFilter.SUB_FILTER| Constructor and Description |
|---|
AbstractFilter()
Default constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addConfiguration(boolean clearAllExisting,
String configId,
String name,
String description,
String parametersLocation) |
protected boolean |
addConfiguration(boolean clearAllExisting,
String configId,
String name,
String description,
String parametersLocation,
String extensions) |
void |
addConfiguration(FilterConfiguration configuration) |
protected 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 |
protected FilterConfiguration |
findConfiguration(String configId) |
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.
|
IParameters |
getParameters()
Gets the current parameters for this filter.
|
protected <A> A |
getParameters(Class<A> expectedClass) |
String |
getParametersClassName() |
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(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 |
setParameters(IParameters params)
Sets new parameters for this filter.
|
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, waitforEachRemaining, removepublic IParameters getParameters()
IFiltergetParameters in interface IFilterpublic void setParameters(IParameters params)
IFiltersetParameters in interface IFilterparams - The new parameters to use.protected <A> A getParameters(Class<A> expectedClass)
public String getParametersClassName()
public 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
overridden 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 FilterConfiguration getConfiguration(String configId)
public boolean removeConfiguration(String configId)
public List<FilterConfiguration> getConfigurations()
IFiltergetConfigurations in interface IFilterpublic EncoderManager getEncoderManager()
IFiltergetEncoderManager in interface IFilterprotected boolean addConfiguration(boolean clearAllExisting,
String configId,
String name,
String description,
String parametersLocation)
protected boolean addConfiguration(boolean clearAllExisting,
String configId,
String name,
String description,
String parametersLocation,
String extensions)
protected boolean addConfigurations(List<FilterConfiguration> configs)
protected FilterConfiguration findConfiguration(String configId)
public 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()
public void setFilterConfigurationMapper(IFilterConfigurationMapper fcMapper)
IFiltersetFilterConfigurationMapper in interface IFilterfcMapper - the mapper to set.public String getDocumentName()
protected void setDocumentName(String documentName)
documentName - the input document name or pathpublic 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 LocaleId getTrgLoc()
public void setTrgLoc(LocaleId trgLoc)
trgLoc - the target locale to setpublic 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 IFilterpublic boolean isGenerateSkeleton()
protected void setGenerateSkeleton(boolean generateSkeleton)
generateSkeleton - the generateSkeleton to setpublic boolean isMultilingual()
protected void setMultilingual(boolean multilingual)
multilingual - the multilingual to setpublic String getName()
IFilterprotected void setName(String name)
public String getDisplayName()
IFiltergetDisplayName in interface IFilterprotected void setDisplayName(String displayName)
public IdGenerator getDocumentId()
public String getParentId()
public void setParentId(String parentId)
protected boolean isUtf8Encoding()
protected boolean isUtf8Bom()
Copyright © 2021. All rights reserved.