public class ParserUtils extends Object
Modifier and Type | Field and Description |
---|---|
static Property |
EMBEDDED_PARSER |
Constructor and Description |
---|
ParserUtils() |
Modifier and Type | Method and Description |
---|---|
static Metadata |
cloneMetadata(Metadata m)
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 the
Parser , unwrapping
any ParserDecorator decorations on top of it. |
static void |
recordParserDetails(Parser parser,
Metadata metadata)
|
static void |
recordParserDetails(String parserClassName,
Metadata metadata)
|
static void |
recordParserFailure(Parser parser,
Throwable failure,
Metadata metadata)
|
static InputStream |
streamResetForReRead(InputStream stream,
TemporaryResources tmp)
Resets the given
TikaInputStream (checked by
ensureStreamReReadable(InputStream, TemporaryResources, Metadata) )
so that it can be re-read again. |
public static final Property EMBEDDED_PARSER
public static Metadata cloneMetadata(Metadata m)
public static String getParserClassname(Parser parser)
Parser
, unwrapping
any ParserDecorator
decorations on top of it.public static void recordParserDetails(String parserClassName, Metadata metadata)
public static void recordParserFailure(Parser parser, Throwable failure, Metadata metadata)
public static InputStream ensureStreamReReadable(InputStream stream, TemporaryResources tmp, Metadata metadata) throws IOException
TikaInputStream
s
created from Files or InputStreamFactories, and RereadableInputStream
.IOException
public static InputStream streamResetForReRead(InputStream stream, TemporaryResources tmp) throws IOException
TikaInputStream
(checked by
ensureStreamReReadable(InputStream, TemporaryResources, Metadata)
)
so that it can be re-read again.IOException
Copyright © 2007–2023 The Apache Software Foundation. All rights reserved.