码迷,mamicode.com
首页 > 其他好文 > 详细

How to write a probeContentType() and Usage?

时间:2016-04-14 13:50:19      阅读:108      评论:0      收藏:0      [点我收藏+]

标签:

Files.probeContentType() is an instance of FileTypeDetector class‘s abstract method String FileTypeDetector.probeContentType(), it‘s an extension based detector. So extend it in a new class or even anonyinter class (cannot do that because FileTypeDetector is an abstract class) might work.

1 public class MyDetector extends java.nio.file.spi.FileTypeDetector{
2     public String probeContentType(Path path) throws IOException{
3         return SOMESTRING;
4     }
5 }
1 //Call the detector
2 String type = MyDetector.probeContentType(path);

 

How to write a probeContentType() and Usage?

标签:

原文地址:http://www.cnblogs.com/sansna/p/5390550.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!