File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes I/O and Streams and the fly likes How to get File extension? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "How to get File extension?" Watch "How to get File extension?" New topic

How to get File extension?

ksp shenoy

Joined: Jun 20, 2004
Posts: 4
Hi all,

I need to determine the extension (or MIME type...) of a file in JAVA..How can I do this...?

Joe Ess

Joined: Oct 29, 2001
Posts: 9189

Getting the extension is easy.

MIME type is a bit more complex. The only place I've seen it used is in the JavaBeans Activation Framework which, given a data source, will use the MIME type to find applications which can handle that data. It's used in the JavaMail framework.

[How To Ask Questions On JavaRanch]
I agree. Here's the link:
subject: How to get File extension?
It's not a secret anymore!