Estimate if file is MIME type

前端 未结 3 513
执念已碎
执念已碎 2021-01-12 10:47

This method should be check if a file is MIME type. To achieve this goal I am using method probeContentType().
However maybe is another way to decide same question. Whic

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-12 11:10

    Another alternative is to Use URLConnection.guessContentTypeFromName(String fileName) if you cannot use Java 7. Note that if the content type cannot be guessed, the method will return null.

提交回复
热议问题