Package org.apache.tika.sax
Class BasicContentHandlerFactory
java.lang.Object
org.apache.tika.sax.BasicContentHandlerFactory
- All Implemented Interfaces:
Serializable,ContentHandlerFactory,WriteLimiter
public class BasicContentHandlerFactory
extends Object
implements ContentHandlerFactory, WriteLimiter
Basic factory for creating common types of ContentHandlers
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCommon handler types for content. -
Constructor Summary
ConstructorsConstructorDescriptionBasicContentHandlerFactory(BasicContentHandlerFactory.HANDLER_TYPE type, int writeLimit) Create a BasicContentHandlerFactory withthrowOnWriteLimitReachedis trueBasicContentHandlerFactory(BasicContentHandlerFactory.HANDLER_TYPE type, int writeLimit, boolean throwOnWriteLimitReached, ParseContext parseContext) -
Method Summary
Modifier and TypeMethodDescriptiongetNewContentHandler(OutputStream os, Charset charset) getType()intbooleanparseHandlerType(String handlerTypeName, BasicContentHandlerFactory.HANDLER_TYPE defaultType) Tries to parse string into handler type.
-
Constructor Details
-
BasicContentHandlerFactory
Create a BasicContentHandlerFactory withthrowOnWriteLimitReachedis true- Parameters:
type- basic type of handlerwriteLimit- max number of characters to store; if < 0, the handler will store all characters
-
BasicContentHandlerFactory
public BasicContentHandlerFactory(BasicContentHandlerFactory.HANDLER_TYPE type, int writeLimit, boolean throwOnWriteLimitReached, ParseContext parseContext) - Parameters:
type- basic type of handlerwriteLimit- maximum number of characters to storethrowOnWriteLimitReached- whether or not to throw aWriteLimitReachedExceptionwhen the write limit has been reachedparseContext- to store the writelimitreached warning if throwOnWriteLimitReached is set tofalse
-
-
Method Details
-
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
- Specified by:
getNewContentHandlerin interfaceContentHandlerFactory
-
getNewContentHandler
- Specified by:
getNewContentHandlerin interfaceContentHandlerFactory
-
getType
- Returns:
- handler type used by this factory
-
getWriteLimit
public int getWriteLimit()- Specified by:
getWriteLimitin interfaceWriteLimiter
-
isThrowOnWriteLimitReached
public boolean isThrowOnWriteLimitReached()- Specified by:
isThrowOnWriteLimitReachedin interfaceWriteLimiter
-