A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
Java SE 8 for the Really Impatient
this week in the
I/O and Streams
How to get File extension?
Joined: Jun 20, 2004
Jun 22, 2004 02:09:00
I need to determine the extension (or MIME type...) of a file in JAVA..How can I do this...?
Joined: Oct 29, 2001
Jun 23, 2004 06:42:00
Getting the extension is easy.
String ext = filename.substring(filename.indexOf('.')+1);
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.
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
How To Ask Questions On JavaRanch
I agree. Here's the link:
subject: How to get File extension?
How to open a file with extension .rar
tar files extraction
Reading a file
checking file extension
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014