Package com.aoindustries.encoding
Enum MediaType
- java.lang.Object
-
- java.lang.Enum<MediaType>
-
- com.aoindustries.encoding.MediaType
-
- All Implemented Interfaces:
Serializable
,Comparable<MediaType>
public enum MediaType extends Enum<MediaType>
Supported content types.- Author:
- AO Industries, Inc.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JAVASCRIPT
A JavaScript script (application/javascript
).JSON
A JSON script (application/json
).LD_JSON
A JSON linked data script (application/ld+json
).MYSQL
The MySQLmysql
command line (text/x-mysql
).PSQL
The PostgreSQLpsql
command line (text/x-psql
).SH
A Bourne shell script (text/x-sh
).TEXT
Any plaintext document comprised of unicode characters (text/plain
).URL
A URL-encoded, & (not &) separated URL.XHTML
An (X)HTML document (application/xhtml+xml
).XHTML_ATTRIBUTE
Indicates that a value contains a XHTML attribute only.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getContentType()
Gets the actual media type, such astext/html
.abstract MarkupType
getMarkupType()
Gets the markup type compatible with this media type.static MediaType
getMediaTypeByName(String name)
Gets the media type for the given name using case-insensitive matching.static MediaType
getMediaTypeForContentType(String fullContentType)
Gets the media type for the provided textual content type.static MediaType
valueOf(String name)
Returns the enum constant of this type with the specified name.static MediaType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
XHTML
public static final MediaType XHTML
An (X)HTML document (application/xhtml+xml
).
-
XHTML_ATTRIBUTE
public static final MediaType XHTML_ATTRIBUTE
Indicates that a value contains a XHTML attribute only. This is a non-standard media type and is only used during internal conversions. The final output should not be this type.
-
JAVASCRIPT
public static final MediaType JAVASCRIPT
A JavaScript script (application/javascript
).
-
JSON
public static final MediaType JSON
A JSON script (application/json
).
-
LD_JSON
public static final MediaType LD_JSON
A JSON linked data script (application/ld+json
).
-
TEXT
public static final MediaType TEXT
Any plaintext document comprised of unicode characters (text/plain
). This is used for any arbitrary, unknown and untrusted data.
-
URL
public static final MediaType URL
A URL-encoded, & (not &) separated URL.
-
SH
public static final MediaType SH
A Bourne shell script (text/x-sh
).
-
MYSQL
public static final MediaType MYSQL
The MySQLmysql
command line (text/x-mysql
).
-
PSQL
public static final MediaType PSQL
The PostgreSQLpsql
command line (text/x-psql
).
-
-
Method Detail
-
values
public static MediaType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MediaType c : MediaType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MediaType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getContentType
public String getContentType()
Gets the actual media type, such astext/html
.
-
getMarkupType
public abstract MarkupType getMarkupType()
Gets the markup type compatible with this media type.
-
getMediaTypeByName
public static MediaType getMediaTypeByName(String name)
Gets the media type for the given name using case-insensitive matching.- Returns:
- the
MediaType
ornull
if not found.
-
getMediaTypeForContentType
public static MediaType getMediaTypeForContentType(String fullContentType) throws UnsupportedEncodingException
Gets the media type for the provided textual content type.- Throws:
UnsupportedEncodingException
-
-