Enum Constant and Description |
---|
BIFF2
BIFF2 raw stream - for Excel 2
|
BIFF3
BIFF3 raw stream - for Excel 3
|
BIFF4
BIFF4 raw stream - for Excel 4
|
BMP
BMP image
|
EMF
EMF image
|
GIF
GIF image
|
HTML
Some different HTML documents
|
JPEG
JPEG image
|
MSWRITE
Old MS Write raw stream
|
OLE2
OLE2 / BIFF8+ stream used for Office 97 and higher documents
|
OOXML
OOXML / ZIP stream - The first 4 bytes of an OOXML file, used in detection
|
PDF
PDF document
|
PNG
PNG Image
|
RTF
RTF document
|
TIFF
TIFF Image
|
UNKNOWN
UNKNOWN magic
|
WMF
WMF image with a placeable header
|
WORD2 |
XML
XML file - The first 5 bytes of a raw XML file, used in detection
|
Modifier and Type | Method and Description |
---|---|
static java.io.InputStream |
prepareToCheckMagic(java.io.InputStream stream)
Checks if an
InputStream can be reset (i.e.
(检查 InputStream 是否可以重置(即)
|
static FileMagic |
valueOf(byte[] magic) |
static FileMagic |
valueOf(java.io.File inp)
Get the file magic of the supplied
File
(获取所提供文件的文件魔法)
|
static FileMagic |
valueOf(java.io.InputStream inp)
Get the file magic of the supplied InputStream (which MUST support mark and reset).
(获取提供的 InputStream 的文件魔法(必须支持标记和重置)。)
|
static FileMagic |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
(返回具有指定名称的此类型的枚举常量。)
|
static FileMagic[] |
values()
Returns an array containing the constants of this enum type, in the order they are declared.
(按照声明的顺序返回包含此枚举类型常量的数组。)
|
public static final FileMagic OLE2
public static final FileMagic OOXML
public static final FileMagic XML
public static final FileMagic BIFF2
public static final FileMagic BIFF3
public static final FileMagic BIFF4
public static final FileMagic MSWRITE
public static final FileMagic RTF
public static final FileMagic PDF
public static final FileMagic HTML
public static final FileMagic WORD2
public static final FileMagic JPEG
public static final FileMagic GIF
public static final FileMagic PNG
public static final FileMagic TIFF
public static final FileMagic WMF
public static final FileMagic EMF
public static final FileMagic BMP
public static final FileMagic UNKNOWN
public static FileMagic[] values()
for (FileMagic c : FileMagic.values()) System.out.println(c);(按照声明的顺序返回包含此枚举类型常量的数组。此方法可用于迭代常量,如下所示: for (FileMagic c : FileMagic.values()) System.out.println(c);)
public static FileMagic valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
(name - 要返回的枚举常量的名称。)
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified name
(java.lang.IllegalArgumentException - 如果此枚举类型没有具有指定名称的常量)
java.lang.NullPointerException
- if the argument is null
(java.lang.NullPointerException - 如果参数为空)
public static FileMagic valueOf(byte[] magic)
public static FileMagic valueOf(java.io.File inp) throws java.io.IOException
File
Even if this method returns UNKNOWN
it could potentially mean, that the ZIP stream has leading junk bytes
inp
- a file to be identified
(inp - 要识别的文件)
java.io.IOException
(java.io.IOException)
public static FileMagic valueOf(java.io.InputStream inp) throws java.io.IOException
If unsure if your InputStream does support mark / reset, use prepareToCheckMagic(InputStream)
to wrap it and make sure to always use that, and not the original!
Even if this method returns UNKNOWN
it could potentially mean, that the ZIP stream has leading junk bytes
inp
- An InputStream which supports either mark/reset
(inp - 支持标记/重置的 InputStream)
java.io.IOException
(java.io.IOException)
public static java.io.InputStream prepareToCheckMagic(java.io.InputStream stream)
InputStream
can be reset (i.e. used for checking the header magic) and wraps it if not
(检查 InputStream 是否可以重置(即用于检查标头魔术),如果不能,则将其包装)
stream
- stream to be checked for wrapping
(stream - 要检查包装的流)
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.