Class FileTypeDetector
- java.lang.Object
-
- com.tom_roush.pdfbox.util.filetypedetector.FileTypeDetector
-
public final class FileTypeDetector extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static FileTypedetectFileType(byte[] fileBytes)static FileTypedetectFileType(BufferedInputStream inputStream)Examines the a file's first bytes and estimates the file's type.
-
-
-
Method Detail
-
detectFileType
public static FileType detectFileType(BufferedInputStream inputStream) throws IOException
Examines the a file's first bytes and estimates the file's type.Requires a
BufferedInputStreamin 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
public static FileType detectFileType(byte[] fileBytes) throws IOException
- Throws:
IOException
-
-