|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.liferay.portal.kernel.util.MimeTypesUtil
public class MimeTypesUtil
Constructor Summary | |
---|---|
MimeTypesUtil()
|
Method Summary | |
---|---|
static String |
getContentType(File file)
Returns the content type from the file. |
static String |
getContentType(File file,
String fileName)
Returns the content type from the file and file name. |
static String |
getContentType(InputStream inputStream,
String fileName)
Returns the content type from the input stream and file name. |
static String |
getContentType(String fileName)
Returns the content type from the file name. |
static String |
getExtensionContentType(String extension)
Returns the content type from the file extension. |
static Set<String> |
getExtensions(String contentType)
Returns the possible file extensions for the content type. |
static MimeTypes |
getMimeTypes()
|
static boolean |
isWebImage(String mimeType)
|
void |
setMimeTypes(MimeTypes mimeTypes)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MimeTypesUtil()
Method Detail |
---|
public static String getContentType(File file)
file
- the file of the content
public static String getContentType(File file, String fileName)
file
- the file of the content (optionally null
)fileName
- the full name or extension of the file (e.g.,
"Test.doc", ".doc")
public static String getContentType(InputStream inputStream, String fileName)
The input stream is not reset upon return of this method. This needs to
be handled by the caller if the input stream is to be reused.
Alternatively, use the method getContentType(File, String)
.
inputStream
- the input stream of the content (optionally
null
)fileName
- the full name or extension of the file (e.g.,
"Test.doc", ".doc")
public static String getContentType(String fileName)
fileName
- the full name or extension of the file (e.g.,
"Test.doc", ".doc")
public static String getExtensionContentType(String extension)
extension
- the extension of the file (e.g., "doc")
public static Set<String> getExtensions(String contentType)
contentType
- the content type of the file (e.g., "image/jpeg")
public static MimeTypes getMimeTypes()
public static boolean isWebImage(String mimeType)
public void setMimeTypes(MimeTypes mimeTypes)
|
Liferay 6.2-ce-ga5 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |