Package org.apache.tika.utils
Class ParserUtils
java.lang.Object
org.apache.tika.utils.ParserUtils
Helper util methods for Parsers themselves.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Metadata
Does a deep clone of a Metadata object.static InputStream
ensureStreamReReadable
(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 String
getParserClassname
(Parser parser) Identifies the real class name of theParser
, unwrapping anyParserDecorator
decorations on top of it.static void
recordParserDetails
(String parserClassName, Metadata metadata) static void
recordParserDetails
(Parser parser, Metadata metadata) static void
recordParserFailure
(Parser parser, Throwable failure, Metadata metadata) static InputStream
streamResetForReRead
(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 anyParserDecorator
decorations 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 includeTikaInputStream
s 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
-