Click here to Skip to main content
15,891,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello,
i have a file named "sxase" in my home directory.on checking the properties i find that the file type is ".mp4".i am looking for a java code that can tell me the extension for the file name "sxase".As i am working on the project that involves implementation of this code too i dont want any tools such as "TRID" etc
THANKS IN ADVANCE
Posted

File type is just an extra few letters on the name, e.g. thistextfile.txt. It has no real meaning beyond being a useful visual aid for the system user. If you want to show all types in Windows explorer then select the Folder options in the Tools menu item, and uncheck the selector titled "Hide extensions for known file types". To get the information in a Java program you would need to get a list of all the files in your directory and separate the extension field from the path name.
 
Share this answer
 
to identify the type of file we must know the MIME Type of the file . While going through the java api i found javax.activation.FileTypeMap. This class has methods, by providing the file object it return the file mime type.

See can this suffice you requirement.

Regards,
Panduranga.
 
Share this answer
 
Comments
Pandu Rang 4-Feb-15 23:49pm    
May i know the reason down vote?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900