net.siefkes.nlstego.util
Class ContentType

java.lang.Object
  extended by net.siefkes.nlstego.util.ContentType

public final class ContentType
extends Object

A simple wrapper for the MIME type and the character set of a document.

Version:
$Revision: 1.5 $, $Date: 2005/07/12 17:02:22 $, $Author: siefkes $
Author:
Christian Siefkes

Field Summary
static String KEY_MIME_TYPE
          Context key recommended to store the MIME type string.
static String MIME_HTML
          MIME type for HTML.
static String MIME_PLAIN
          MIME type for plain text.
 
Method Summary
static ContentType determineContentType(String contentTypeHeader)
          Factory method to determines the content type based an "Content-Type" header.
 String getCharset()
          Returns the character set.
 String getMimeType()
          Returns the MIME type.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY_MIME_TYPE

public static final String KEY_MIME_TYPE
Context key recommended to store the MIME type string.

See Also:
Constant Field Values

MIME_HTML

public static final String MIME_HTML
MIME type for HTML.

See Also:
Constant Field Values

MIME_PLAIN

public static final String MIME_PLAIN
MIME type for plain text.

See Also:
Constant Field Values
Method Detail

determineContentType

public static ContentType determineContentType(String contentTypeHeader)
Factory method to determines the content type based an "Content-Type" header. The "Content-Type" header is examined first, if it is specified (not null or empty). If this does not lead to a result, the extension is examined.

Parameters:
contentTypeHeader - the "Content-Type" header of an URL, as returned by URLConnection.getContentType() (might be null)
Returns:
the determined content type

getCharset

public String getCharset()
Returns the character set.

Returns:
the character set, or null if unknown

getMimeType

public String getMimeType()
Returns the MIME type.

Returns:
the MIME type, or null if unknown

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object
Returns:
a textual representation


Copyright © 2003-2005 Christian Siefkes. All Rights Reserved.