Java 推断资源的 Content-Type
Java Content-Type 大约 264 字代码
使用JDK7
中引入的Files
类的probeContentType
方法。
获取的Content-Type
为image/png
、image/jpg
等。
public static void main(String[] args) {
try {
String contentType = Files.probeContentType(Paths.get(""));
} catch (IOException e) {
e.printStackTrace();
}
}
阅读 999 · 发布于 2020-05-25
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称: