Class FileTypeDetector
java.lang.Object
org.apache.pdfbox.util.filetypedetector.FileTypeDetector
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FileType
detectFileType
(byte[] fileBytes) static FileType
detectFileType
(BufferedInputStream inputStream) Examines the a file's first bytes and estimates the file's type.
-
Field Details
-
root
-
-
Constructor Details
-
FileTypeDetector
private FileTypeDetector()
-
-
Method Details
-
detectFileType
Examines the a file's first bytes and estimates the file's type.Requires a
BufferedInputStream
in order to mark and reset the stream to the position at which it was provided to this method once completed.Requires the stream to contain at least eight bytes.
- Parameters:
inputStream
- a buffered input stream of the file to examine.- Returns:
- the file type.
- Throws:
IOException
- if an IO error occurred or the input stream ended unexpectedly.
-
detectFileType
- Throws:
IOException
-