public class ParserFactory extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
log |
Constructor and Description |
---|
ParserFactory() |
Modifier and Type | Method and Description |
---|---|
protected static Parser |
detectParser(File file,
InputStream is,
String filename,
Locale locale,
String encoding)
Internal method containing the lookup logic. can be invoked with a File
OR an InputStream.
|
static Set<String> |
getExtensions() |
static Parser |
getParser(File file,
String filename,
Locale locale,
String encoding) |
static Parser |
getParser(InputStream is,
String filename,
Locale locale,
String encoding) |
static Parser |
getParser(String filename) |
static Map<String,Class> |
getParsers() |
static void |
init()
Registers all parsers from extension points
|
static void |
setAliases(String ext,
String[] aliases)
Adds new aliases for the specified extension.
|
public static void init()
public static Parser getParser(File file, String filename, Locale locale, String encoding)
protected static Parser detectParser(File file, InputStream is, String filename, Locale locale, String encoding)
file
- is
- filename
- locale
- encoding
- public static Parser getParser(InputStream is, String filename, Locale locale, String encoding)
public static void setAliases(String ext, String[] aliases)
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'
ext
- Must be one of the registered extensionsaliases
- Array of extension aliases (eg. test, acme ...)Copyright © 2008-2014 Logical Objects. All Rights Reserved.