public class FileTypeDetector extends Object
| Modifier and Type | Method and Description |
|---|---|
static FileType |
detectFileType(InputStream inputStream)
Examines the file's bytes and estimates the file's type.
|
static FileType |
detectFileType(InputStream inputStream,
String filePath)
Examines the file's bytes and estimates the file's type.
|
public static FileType detectFileType(InputStream inputStream) throws IOException
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.
IOException - if the stream does not support mark/reset.public static FileType detectFileType(InputStream inputStream, String filePath) throws IOException
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.
filePath - The file path or file name of the file, if available. Only the extension is used.IOException - if the stream does not support mark/reset.Copyright © 2002-2023 Drew Noakes. All Rights Reserved.