org.gcube.portlets.user.homelibrary.util
Class MimeTypeUtil
java.lang.Object
org.gcube.portlets.user.homelibrary.util.MimeTypeUtil
public class MimeTypeUtil
- extends Object
- Author:
- Federico De Faveri defaveri@isti.cnr.it
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
logger
protected static final org.apache.log4j.Logger logger
BINARY_MIMETYPE
public static final String BINARY_MIMETYPE
- See Also:
- Constant Field Values
ZIP_MIMETYPES
public static final String[] ZIP_MIMETYPES
mimetype_extension_map
protected static final Map<String,String> mimetype_extension_map
extension_mimetype_map
protected static final Map<String,String> extension_mimetype_map
MimeTypeUtil
public MimeTypeUtil()
loadExtensions
protected static void loadExtensions(InputStream is)
throws IOException
- Throws:
IOException
loadMimeTypes
protected static void loadMimeTypes(InputStream is)
throws IOException
- Throws:
IOException
getExtension
public static String getExtension(String mimeType)
- Parameters:
mimeType - the mime type.
- Returns:
- the related extension.
getMimeType
public static String getMimeType(String extension)
- Parameters:
extension - the extension.
- Returns:
- the related mime type.
getMimeType
public static String getMimeType(File file)
- Parameters:
file - the file to check.
- Returns:
- the mime type.
getMimeType
public static String getMimeType(InputStream file)
- Parameters:
file - the file to check
- Returns:
- the mime type.
main
public static void main(String[] args)
throws IOException
- Parameters:
args - arguments.
- Throws:
IOException - if an error occurs.
getNameWithExtension
public static String getNameWithExtension(String name,
String mimeType)
- Parameters:
name - the file name.mimeType - the mime type.
- Returns:
- the right name.
isZipContentType
public static boolean isZipContentType(String contentType)
- Check if the content type is a zip type.
- Parameters:
contentType - the content type to check.
- Returns:
true if is a zip file, false otherwise.
Copyright © 2013. All Rights Reserved.