Test if a file is an image file

后端 未结 8 1255
情深已故
情深已故 2020-12-01 07:55

I am using some file IO and want to know if there is a method to check if a file is an image?

8条回答
  •  长情又很酷
    2020-12-01 08:04

    if( ImageIO.read(*here your input stream*) == null)
        *IS NOT IMAGE*    
    

    And also there is an answer: How to check a uploaded file whether it is a image or other file?

提交回复
热议问题