Package com.logicaldoc.core.parser
Class ParserFactory
java.lang.Object
com.logicaldoc.core.parser.ParserFactory
This is a factory, returning a parser instance for the given file.
- Author:
- Michael Scholz
- 
Method SummaryModifier and TypeMethodDescriptionstatic ParserMethod containing the lookup logicstatic voidinit()Registers all parsers from extension pointsstatic Stringparse(InputStream input, String filename, String encoding, Locale locale, long tenantId, Document document, String fileVersion) Gets the proper parser and parse the given contentstatic voidsetAliases(String ext, String[] aliases) Adds new aliases for the specified extension.
- 
Method Details- 
initpublic static void init()Registers all parsers from extension points
- 
parsepublic static String parse(InputStream input, String filename, String encoding, Locale locale, long tenantId, Document document, String fileVersion) throws ParsingException Gets the proper parser and parse the given content- Parameters:
- input- the input contents as stream
- filename- name of the file
- encoding- encoding of the stream
- locale- the locale
- tenantId- identifier of the tenant
- document- the document the file belongs to (optional)
- fileVersion- the file version being processed (optional)
- Returns:
- the text extracted from the input
- Throws:
- ParsingException- error in the parsing
 
- 
getParserMethod containing the lookup logic- Parameters:
- filename- name of the file
- Returns:
- the right parser for the given file name
 
- 
getExtensions
- 
getParsers
- 
setAliasesAdds new aliases for the specified extension.Each alias is saved as property parser.alias.<ext> 
 example: parser.alias.odt = test, acme
 In this case an extension 'test' will be treated as 'odt'- Parameters:
- ext- Must be one of the registered extensions
- aliases- Array of extension aliases (eg. test, acme ...)
 
 
-