play.libs
类 MimeTypes

java.lang.Object
  继承者 play.libs.MimeTypes

public class MimeTypes
extends java.lang.Object

MimeTypes utils


构造方法摘要
MimeTypes()
           
 
方法摘要
static java.lang.String getContentType(java.lang.String filename)
          return the content-type from a file name.
static java.lang.String getContentType(java.lang.String filename, java.lang.String defaultContentType)
          return the content-type from a file name.
static java.lang.String getMimeType(java.lang.String filename)
          return the mimetype from a file name
static java.lang.String getMimeType(java.lang.String filename, java.lang.String defaultMimeType)
          return the mimetype from a file name.
static boolean isValidMimeType(java.lang.String mimeType)
          check the mimetype is referenced in the mimetypes database
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

MimeTypes

public MimeTypes()
方法详细信息

getMimeType

public static java.lang.String getMimeType(java.lang.String filename)
return the mimetype from a file name

参数:
filename - the file name
返回:
the mimetype or the empty string if not found

getMimeType

public static java.lang.String getMimeType(java.lang.String filename,
                                           java.lang.String defaultMimeType)
return the mimetype from a file name.

参数:
filename - the file name
defaultMimeType - the default mime type to return when no matching mimetype is found
返回:
the mimetype

getContentType

public static java.lang.String getContentType(java.lang.String filename)
return the content-type from a file name. If none is found returning application/octet-stream
For a text-based content-type, also return the encoding suffix eg. "text/plain; charset=utf-8"

参数:
filename - the file name
返回:
the content-type deduced from the file extension.

getContentType

public static java.lang.String getContentType(java.lang.String filename,
                                              java.lang.String defaultContentType)
return the content-type from a file name.
For a text-based content-type, also return the encoding suffix eg. "text/plain; charset=utf-8"

参数:
filename - the file name
defaultContentType - the default content-type to return when no matching content-type is found
返回:
the content-type deduced from the file extension.

isValidMimeType

public static boolean isValidMimeType(java.lang.String mimeType)
check the mimetype is referenced in the mimetypes database

参数:
mimeType - the mimeType to verify


Guillaume Bort & zenexity - Distributed under Apache 2 licence, without any warrantly