public class SiegfriedDetector extends Object implements Detector
Modifier and Type | Field and Description |
---|---|
static String |
BASIS |
static String |
ERRORS |
static String |
FORMAT |
static String |
ID |
static String |
MIME |
static Property |
SIEGFRIED_ERRORS |
static Property |
SIEGFRIED_IDENTIFIERS_DETAILS |
static Property |
SIEGFRIED_IDENTIFIERS_NAME |
static String |
SIEGFRIED_PREFIX |
static Property |
SIEGFRIED_SIGNATURE |
static Property |
SIEGFRIED_STATUS |
static Property |
SIEGFRIED_VERSION |
static String |
VERSION |
static String |
WARNING |
Constructor and Description |
---|
SiegfriedDetector() |
Modifier and Type | Method and Description |
---|---|
static boolean |
checkHasSiegfried(String siegfriedCommandPath) |
MediaType |
detect(InputStream input,
Metadata metadata)
Detects the content type of the given input document.
|
boolean |
isUseMime() |
protected static MediaType |
processResult(FileProcessResult result,
Metadata metadata,
boolean returnMime) |
void |
setMaxBytes(int maxBytes)
If this is not called on a TikaInputStream, this detector
will spool up to this many bytes to a file to be detected
by the 'file' command.
|
void |
setSiegfriedPath(String fileCommandPath) |
void |
setTimeoutMs(long timeoutMs) |
void |
setUseMime(boolean useMime)
As default behavior, Tika runs Siegfried to add its detection
to the metadata, but NOT to use detection in determining parsers
etc.
|
public static final String SIEGFRIED_PREFIX
public static Property SIEGFRIED_STATUS
public static Property SIEGFRIED_VERSION
public static Property SIEGFRIED_SIGNATURE
public static Property SIEGFRIED_IDENTIFIERS_NAME
public static Property SIEGFRIED_IDENTIFIERS_DETAILS
public static Property SIEGFRIED_ERRORS
public static String ID
public static String FORMAT
public static String VERSION
public static String MIME
public static String WARNING
public static String BASIS
public static String ERRORS
public static boolean checkHasSiegfried(String siegfriedCommandPath)
public MediaType detect(InputStream input, Metadata metadata) throws IOException
Detector
application/octet-stream
if the type of the document
can not be detected.
If the document input stream is not available, then the first
argument may be null
. Otherwise the detector may
read bytes from the start of the stream to help in type detection.
The given stream is guaranteed to support the
mark feature
and the detector
is expected to mark
the stream before
reading any bytes from it, and to reset
the stream before returning. The stream must not be closed by the
detector.
The given input metadata is only read, not modified, by the detector.
detect
in interface Detector
input
- document input stream, or null
metadata
- input metadata for the documentIOException
@Field public void setUseMime(boolean useMime)
true
, this detector
will return the first mime detected by Siegfried and that
mime will be used by the AutoDetectParser to select the appropriate
parser.useMime
- public boolean isUseMime()
protected static MediaType processResult(FileProcessResult result, Metadata metadata, boolean returnMime)
@Field public void setMaxBytes(int maxBytes)
maxBytes
- @Field public void setTimeoutMs(long timeoutMs)
Copyright © 2007–2023 The Apache Software Foundation. All rights reserved.