public abstract class TextExtractor extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
TextExtractor.BinaryOperation<T>
Interface which can be used by subclasses to process the input stream of a binary property.
|
static interface |
TextExtractor.Context
Interface which provides additional information to the text extractors, during the extraction operation.
|
static interface |
TextExtractor.Output
The interface passed to a TextExtractor to which the extractor should record all text content.
|
| Constructor and Description |
|---|
TextExtractor() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
extractFrom(Binary binary,
TextExtractor.Output output,
TextExtractor.Context context)
Extract text from the given
Binary, using the given output to record the results. |
protected Set<String> |
getExcludedMimeTypes() |
protected Set<String> |
getIncludedMimeTypes() |
String |
getName()
Returns the text extractor name.
|
protected Logger |
logger() |
protected <T> T |
processStream(Binary binary,
TextExtractor.BinaryOperation<T> operation)
Allows subclasses to process the stream of binary value property in "safe" fashion, making sure the stream is closed at the
end of the operation.
|
void |
setLogger(Logger logger)
Sets a logger instance.
|
void |
setName(String name)
Sets the text extractor name.
|
abstract boolean |
supportsMimeType(String mimeType)
Determine if this extractor is capable of processing content with the supplied MIME type.
|
public abstract boolean supportsMimeType(String mimeType)
mimeType - the MIME type; never nullpublic abstract void extractFrom(Binary binary, TextExtractor.Output output, TextExtractor.Context context) throws Exception
Binary, using the given output to record the results.binary - the binary value that can be used in the extraction process; never nulloutput - the output from the sequencing operation; never nullcontext - the context for the sequencing operation; never nullException - if there is a problem during the extraction processprotected final <T> T processStream(Binary binary, TextExtractor.BinaryOperation<T> operation) throws Exception
T - the return type of the binary operationbinary - a Binary who is expected to contain a non-null binary value.operation - a TextExtractor.BinaryOperation which should work with the streamException - if there is an error processing the streampublic final void setLogger(Logger logger)
logger - a Logger, never nullprotected final Logger logger()
Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.