public final class FileTypeDetector extends Object
| Modifier and Type | Method and Description |
|---|---|
static FileType |
detectFileType(BufferedInputStream inputStream)
Examines the a file's first bytes and estimates the file's type.
|
static FileType |
detectFileType(byte[] fileBytes) |
public static FileType detectFileType(BufferedInputStream inputStream) throws IOException
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.
inputStream - a buffered input stream of the file to examine.IOException - if an IO error occurred or the input stream ended unexpectedly.public static FileType detectFileType(byte[] fileBytes)
Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.