import java.io.File; import javax.activation.MimetypesFileTypeMap; public class TestMimeType { public static void main(String[] args) { String fileName = "C://bunny.mp4"; MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); // only by file name String mimeType = mimeTypesMap.getContentType(fileName); // or by actual File instance File file = new File(fileName); mimeType = mimeTypesMap.getContentType(file); System.out.println(mimeType); } }
Friday, 14 June 2013
Find Mime Type Of a file in java
Labels:
Tools & Utility
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment