Class FileTypeDetector


  • public class FileTypeDetector
    extends Object
    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 file's 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.

        Throws:
        IOException - if an IO error occurred or the input stream ended unexpectedly.