I try to read file type using two ways. It is working while using ByteArrayInputStream but not FileInputStream
Using FileInputStream with URLConnection,
String fileType = URLConnection
  .guessContentTypeFromStream(
    new FileInputStream(new File("C:\\image.jpeg"))
   ); //fileType = null
Using ByteArrayInputStream with URLConnection
String fileType = URLConnection
.guessContentTypeFromStream(
  new ByteArrayInputStream(Files.readAllBytes(new File("C:\\image.jpeg").toPath()))
 ); //fileType = image/jpeg
Why is the difference in the result ? 
Also, is there anywhere mentioned to use only ByteArrayInputStream to read the file type?