Package org.apache.tika.parser.multiple
Class FallbackParser
java.lang.Object
org.apache.tika.parser.multiple.AbstractMultipleParser
org.apache.tika.parser.multiple.FallbackParser
- All Implemented Interfaces:
Serializable
,Parser
Tries multiple parsers in turn, until one succeeds.
Can optionally keep Metadata from failed parsers when
trying the next one, depending on the AbstractMultipleParser.MetadataPolicy
chosen.
- Since:
- Apache Tika 1.18
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.tika.parser.multiple.AbstractMultipleParser
AbstractMultipleParser.MetadataPolicy
-
Field Summary
Modifier and TypeFieldDescriptionstatic final List<AbstractMultipleParser.MetadataPolicy>
The different Metadata Policies we support (all)Fields inherited from class org.apache.tika.parser.multiple.AbstractMultipleParser
METADATA_POLICY_CONFIG_KEY
-
Constructor Summary
ConstructorDescriptionFallbackParser
(MediaTypeRegistry registry, Collection<? extends Parser> parsers, Map<String, Param> params) FallbackParser
(MediaTypeRegistry registry, AbstractMultipleParser.MetadataPolicy policy, Collection<? extends Parser> parsers) FallbackParser
(MediaTypeRegistry registry, AbstractMultipleParser.MetadataPolicy policy, Parser... parsers) -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
parserCompleted
(Parser parser, Metadata metadata, ContentHandler handler, ParseContext context, Exception exception) Used to notify implementations that a Parser has Finished or Failed, and to allow them to decide to continue or abort further parsingMethods inherited from class org.apache.tika.parser.multiple.AbstractMultipleParser
getAllParsers, getMediaTypeRegistry, getMetadataPolicy, getMetadataPolicy, getSupportedTypes, mergeMetadata, parse, parse, parserPrepare, setMediaTypeRegistry
-
Field Details
-
allowedPolicies
The different Metadata Policies we support (all)
-
-
Constructor Details
-
FallbackParser
public FallbackParser(MediaTypeRegistry registry, Collection<? extends Parser> parsers, Map<String, Param> params) -
FallbackParser
public FallbackParser(MediaTypeRegistry registry, AbstractMultipleParser.MetadataPolicy policy, Collection<? extends Parser> parsers) -
FallbackParser
public FallbackParser(MediaTypeRegistry registry, AbstractMultipleParser.MetadataPolicy policy, Parser... parsers)
-
-
Method Details
-
parserCompleted
protected boolean parserCompleted(Parser parser, Metadata metadata, ContentHandler handler, ParseContext context, Exception exception) Description copied from class:AbstractMultipleParser
Used to notify implementations that a Parser has Finished or Failed, and to allow them to decide to continue or abort further parsing- Specified by:
parserCompleted
in classAbstractMultipleParser
-