Package org.apache.tika.sax
Class BasicContentHandlerFactory
- java.lang.Object
-
- org.apache.tika.sax.BasicContentHandlerFactory
-
- All Implemented Interfaces:
Serializable
,ContentHandlerFactory
public class BasicContentHandlerFactory extends Object implements ContentHandlerFactory
Basic factory for creating common types of ContentHandlers- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BasicContentHandlerFactory.HANDLER_TYPE
Common handler types for content.
-
Constructor Summary
Constructors Constructor Description BasicContentHandlerFactory(BasicContentHandlerFactory.HANDLER_TYPE type, int writeLimit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ContentHandler
getNewContentHandler()
ContentHandler
getNewContentHandler(OutputStream os, String encoding)
ContentHandler
getNewContentHandler(OutputStream os, Charset charset)
BasicContentHandlerFactory.HANDLER_TYPE
getType()
static BasicContentHandlerFactory.HANDLER_TYPE
parseHandlerType(String handlerTypeName, BasicContentHandlerFactory.HANDLER_TYPE defaultType)
Tries to parse string into handler type.
-
-
-
Constructor Detail
-
BasicContentHandlerFactory
public BasicContentHandlerFactory(BasicContentHandlerFactory.HANDLER_TYPE type, int writeLimit)
- Parameters:
type
- basic type of handlerwriteLimit
- max number of characters to store; if < 0, the handler will store all characters
-
-
Method Detail
-
parseHandlerType
public static BasicContentHandlerFactory.HANDLER_TYPE parseHandlerType(String handlerTypeName, BasicContentHandlerFactory.HANDLER_TYPE defaultType)
Tries to parse string into handler type. Returns default if string is null or parse fails. Options: xml, html, text, body, ignore (no content)- Parameters:
handlerTypeName
- string to parsedefaultType
- type to return if parse fails- Returns:
- handler type
-
getNewContentHandler
public ContentHandler getNewContentHandler()
- Specified by:
getNewContentHandler
in interfaceContentHandlerFactory
-
getNewContentHandler
public ContentHandler getNewContentHandler(OutputStream os, String encoding) throws UnsupportedEncodingException
- Specified by:
getNewContentHandler
in interfaceContentHandlerFactory
- Throws:
UnsupportedEncodingException
-
getNewContentHandler
public ContentHandler getNewContentHandler(OutputStream os, Charset charset)
- Specified by:
getNewContentHandler
in interfaceContentHandlerFactory
-
getType
public BasicContentHandlerFactory.HANDLER_TYPE getType()
- Returns:
- handler type used by this factory
-
-