Package org.apache.tika.utils
Class ParserUtils
java.lang.Object
org.apache.tika.utils.ParserUtils
Helper util methods for Parsers themselves.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic MetadataDoes a deep clone of a Metadata object.static InputStreamensureStreamReReadable(InputStream stream, TemporaryResources tmp, Metadata metadata) Ensures that the Stream will be able to be re-read, by buffering to a temporary file if required.static StringgetParserClassname(Parser parser) Identifies the real class name of theParser, unwrapping anyParserDecoratordecorations on top of it.static voidrecordParserDetails(String parserClassName, Metadata metadata) static voidrecordParserDetails(Parser parser, Metadata metadata) static voidrecordParserFailure(Parser parser, Throwable failure, Metadata metadata) static InputStreamstreamResetForReRead(InputStream stream, TemporaryResources tmp) Resets the givenTikaInputStream(checked byensureStreamReReadable(InputStream, TemporaryResources, Metadata)) so that it can be re-read again.
-
Field Details
-
EMBEDDED_PARSER
-
-
Constructor Details
-
ParserUtils
public ParserUtils()
-
-
Method Details
-
cloneMetadata
Does a deep clone of a Metadata object. -
getParserClassname
Identifies the real class name of theParser, unwrapping anyParserDecoratordecorations on top of it. -
recordParserDetails
-
recordParserDetails
-
recordParserFailure
-
ensureStreamReReadable
public static InputStream ensureStreamReReadable(InputStream stream, TemporaryResources tmp, Metadata metadata) throws IOException Ensures that the Stream will be able to be re-read, by buffering to a temporary file if required. Streams that are automatically OK includeTikaInputStreams created from Files or InputStreamFactories, andRereadableInputStream.- Throws:
IOException
-
streamResetForReRead
public static InputStream streamResetForReRead(InputStream stream, TemporaryResources tmp) throws IOException Resets the givenTikaInputStream(checked byensureStreamReReadable(InputStream, TemporaryResources, Metadata)) so that it can be re-read again.- Throws:
IOException
-