楔子
java获取文件类型
例子
@Test
public void txtType() throws Exception {
//需要注意的是 有些文件(例如 shell文件 获取的结果为null)
String type = Files.probeContentType(Paths.get("c:/1.sh"));
System.out.println(type);
}
java获取文件类型
@Test
public void txtType() throws Exception {
//需要注意的是 有些文件(例如 shell文件 获取的结果为null)
String type = Files.probeContentType(Paths.get("c:/1.sh"));
System.out.println(type);
}