Class FileTypeDetector

java.lang.Object
com.drew.imaging.FileTypeDetector

public class FileTypeDetector extends Object
Examines the a file's first bytes and estimates the file's type.
  • Method Details

    • detectFileType

      public static FileType detectFileType(InputStream inputStream) throws IOException
      Examines the file's bytes and estimates the file's type.

      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.

      Throws:
      IOException - if the stream does not support mark/reset.