Package com.drew.imaging
Class FileTypeDetector
- java.lang.Object
-
- com.drew.imaging.FileTypeDetector
-
public class FileTypeDetector extends java.lang.ObjectExamines the a file's first bytes and estimates the file's type.
-
-
Field Summary
Fields Modifier and Type Field Description private static int_bytesNeededprivate static TypeChecker[]_fixedCheckersprivate static ByteTrie<FileType>_root
-
Constructor Summary
Constructors Modifier Constructor Description privateFileTypeDetector()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FileTypedetectFileType(java.io.InputStream inputStream)Examines the file's bytes and estimates the file's type.
-
-
-
Field Detail
-
_fixedCheckers
private static final TypeChecker[] _fixedCheckers
-
_bytesNeeded
private static final int _bytesNeeded
-
-
Method Detail
-
detectFileType
public static FileType detectFileType(java.io.InputStream inputStream) throws java.io.IOException
Examines the file's bytes and estimates the file's type.The input stream must support mark and reset, in order to return the stream to the position at which it was provided to this method once completed.
Requires the stream to contain at least eight bytes.
- Throws:
java.io.IOException- if the stream does not support mark/reset.
-
-