Re: How to get file extention from Content-type.
- From: Thomas Weidenfeller <nobody@xxxxxxxxxxxxxxxx>
- Date: Thu, 30 Jun 2005 08:50:47 +0200
shilpa wrote:
I want to get file extention from file's content-type. I wanted to handle file with blank name in my mail client. For handling this I need to create temporary file. For that I need to decide file extention based on content-type.
getFileNameMap(..) function of UrlConnection constructs FileNameMap but FileNameMap has method just to fetch content type from file extetion. I want exactly opposite of this i.e File extention from Content-Type.
Sorry, but this doesn't make much sense. You talk about e-mail (which would be POP3, IMAP, SMTP or similar), then you talk about a file, but then you also talk about URLConnection (which would mean HTTP). So what is it from what you want to get some content type information? And what content type? I would guess we are talking MIME types here, aren't we?
If it is e-mail, then JavaMail has the means to extract MIME parts from a mail and provide you with the MIME types of the parts. If it is a file you probably want the JavaBeans Activation Framework (JAF) alone. If it is HTTP and URLConnection is not enough, you might want to look into Apache/Jakarta/Commons.
/Thomas
-- The comp.lang.java.gui FAQ: ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/ .
- Follow-Ups:
- Re: How to get file extention from Content-type.
- From: shilpa
- Re: How to get file extention from Content-type.
- References:
- How to get file extention from Content-type.
- From: shilpa
- How to get file extention from Content-type.
- Prev by Date: How to get file extention from Content-type.
- Next by Date: Doubts in using java.beans.EventHandler
- Previous by thread: How to get file extention from Content-type.
- Next by thread: Re: How to get file extention from Content-type.
- Index(es):