org.apache.tomcat.util.http

## Class ContentType

- java.lang.Object
- - org.apache.tomcat.util.http.ContentType

-     public class ContentType
      extends Object

  Useful methods for Content-Type processing
  Author:
    James Duncan Davidson [duncan@eng.sun.com], James Todd [gonzo@eng.sun.com], Jason Hunter [jch@eng.sun.com], Harish Prabandham, costin@eng.sun.com

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ContentType()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static String` | `getCharsetFromContentType(String contentType)` Parse the character encoding from the specified content type header.
    `static boolean` | `hasCharset(String type)` Returns true if the given content type contains a charset component, false otherwise.

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

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

- - ### Constructor Detail

    - #### ContentType

          public ContentType()

  - ### Method Detail

    - #### getCharsetFromContentType

          public static String getCharsetFromContentType(String contentType)

      Parse the character encoding from the specified content type header. If the content type is null, or there is no explicit character encoding, `null` is returned.
      Parameters:
        `contentType` - a content type header

    - #### hasCharset

          public static boolean hasCharset(String type)

      Returns true if the given content type contains a charset component, false otherwise.
      Parameters:
        `type` - Content type
      Returns:
        true if the given content type contains a charset component, false otherwise

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.