org.restlet.engine.http.header

## Class ContentType

- java.lang.Object
- - org.restlet.engine.http.header.ContentType

    public class ContentType
    extends java.lang.Object

Association of a media type and a character set.

Author:
  Jerome Louvel

### Constructor Summary

Constructors
Constructor and Description
`ContentType(MediaType mediaType, CharacterSet characterSet)` Constructor.
`ContentType(java.lang.String headerValue)` Constructor.

### Method Summary

Methods
`CharacterSet` `getCharacterSet()` Returns the character set.
`MediaType` `getMediaType()` Returns the media type.
`static CharacterSet` `readCharacterSet(java.lang.String contentType)` Parses the given content type header and returns the character set.
`static MediaType` `readMediaType(java.lang.String contentType)` Parses the given content type header and returns the media type.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### ContentType

    public ContentType(MediaType mediaType,
               CharacterSet characterSet)

Constructor.

Parameters:
  `mediaType` - The media type.
  `characterSet` - The character set.

#### ContentType

    public ContentType(java.lang.String headerValue)

Constructor.

Parameters:
  `headerValue` - The "Content-type" header to parse.

### Method Detail

#### readMediaType

    public static MediaType readMediaType(java.lang.String contentType)

Parses the given content type header and returns the media type.

Parameters:
  `contentType` - The content type header to parse.
Returns:
  The media type.

#### readCharacterSet

    public static CharacterSet readCharacterSet(java.lang.String contentType)

Parses the given content type header and returns the character set.

Parameters:
  `contentType` - The content type header to parse.
Returns:
  The character set.

#### getCharacterSet

    public CharacterSet getCharacterSet()

Returns the character set.

Returns:
  The character set.

#### getMediaType

    public MediaType getMediaType()

Returns the media type.

Returns:
  The media type.