public class MimeType extends Object implements Serializable
| Constructor and Description |
|---|
MimeType(MimeType mimeType)
Clone an instance from
mimeType |
MimeType(String type)
Create an instance
|
MimeType(String type,
String subtype)
Create an instance
|
MimeType(String type,
String subtype,
Map<String,String> parameters)
Create an instance
|
| Modifier and Type | Method and Description |
|---|---|
Charset |
getCharset()
Returns the charset parameter or the defualt charset
US-ASCII if
charset parameter absent |
Charset |
getCharset(Charset defaultCharset)
Returns the charset parameter or the defualt charset if charset parameter
absent
|
String |
getParameter(String name)
Returns the value of the specified parameter or null if not exists
|
String |
getParameter(String name,
String defaultValue)
Returns the value of the specified parameter or null if not exists
|
Map<String,String> |
getParameters()
Returns the parameter names
|
String |
getSubtype()
Returns the subtype
|
String |
getType()
Returns the type
|
static MimeType |
guess(File file) |
static MimeType |
guess(File file,
MimeType defaultType) |
static MimeType |
guess(String url) |
static MimeType |
guess(String url,
MimeType defaultType) |
boolean |
hasParameter(String name)
Determine if the specified parameter exists
|
boolean |
isWildcardSubtype()
Determine if the subtype is the wildcard character
* or the wildcard
character followed by a suffix (e.g. |
boolean |
isWildcardType()
Determine if the type is the wildcard character
* |
static MimeType |
parse(String string)
Parse string as
MimeType |
String |
toString() |
public MimeType(MimeType mimeType)
mimeTypemimeType - The original mimeTypepublic MimeType(String type) throws MalformedMimeTypeException
type - The MIME media typeMalformedMimeTypeExceptionpublic MimeType(String type, String subtype) throws MalformedMimeTypeException
type - The MIME media typesubtype - The MIME media subtypeMalformedMimeTypeExceptionpublic MimeType(String type, String subtype, Map<String,String> parameters) throws MalformedMimeTypeException
type - The MIME media typesubtype - The MIME media subtypeparameters - The parametersMalformedMimeTypeExceptionpublic static MimeType parse(String string) throws MalformedMimeTypeException
MimeTypestring - The MIME type stringMimeTypeMalformedMimeTypeException - if the the specified MIME Type string is malformedpublic String getType()
public String getSubtype()
public boolean hasParameter(String name)
name - The parameter name to determinepublic String getParameter(String name)
name - The parameter namepublic String getParameter(String name, String defaultValue)
name - The parameter namepublic Charset getCharset()
US-ASCII if
charset parameter absentpublic Charset getCharset(Charset defaultCharset)
defaultCharset - The default charset to return if charset parameter absentpublic boolean isWildcardType()
*public boolean isWildcardSubtype()
* or the wildcard
character followed by a suffix (e.g. *+xml).Copyright © 2015–2017 SDKLite. All rights reserved.