Package com.jalios.jcms.fileprocessor
Interface FileParser
- All Superinterfaces:
FileActionComponent
- All Known Implementing Classes:
SampleProcessor
A class that implements this interface is a parser for at least one kind of files.
It is supposed to extract (parse) the text from the supported files.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.jalios.jcms.fileprocessor.FileActionComponent
FileActionComponent.Operation -
Field Summary
Fields inherited from interface com.jalios.jcms.fileprocessor.FileActionComponent
CURRENT_FILE_DOCUMENT, CURRENT_OPERATION, FILE_SEPARATOR, PROCESSING_TYPE -
Method Summary
Modifier and TypeMethodDescriptiondefault voidParsers may implement this method for very efficient text extraction.extractText(File file, Map<String, Object> ctxt) Parsers have to implement at least this method which extract the text from the specified file and returns it.Methods inherited from interface com.jalios.jcms.fileprocessor.FileActionComponent
getDescription, getName, getOrder, isAvailable
-
Method Details
-
extractText
Parsers have to implement at least this method which extract the text from the specified file and returns it.- Parameters:
file- the file to parsectxt- a Map to share informations between processings.- Returns:
- the text to index (can be empty) or null if no action was processed (do not return null in case of error, instead throw a ProcessingException).
- Throws:
ProcessingException- if the text could not be extracted.
-
extractText
default void extractText(File inFile, File outFile, Map<String, Object> ctxt) throws ProcessingExceptionParsers may implement this method for very efficient text extraction.It allows parser to provide more efficient parsing for large file (i.e. consuming less memory without loading all text in memory).
The default implementation provided delegates to simpler and historical
extractText(File, Map)method.- Parameters:
inFile- the file to parseoutFile- the UTF-8 text file in which extracted text must be written.ctxt- a Map to share informations between processings.- Throws:
ProcessingException- if the text could not be extracted or saved.- Since:
- JCMS-5312
-