首页 > 其他 > 详细

How to write a probeContentType() and Usage?

时间:2016-04-14 13:48:32      阅读:286      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!