Jive Forums API (5.5.8) Developer Javadocs

com.jivesoftware.forum.nntp.spi
Class MimeTools

java.lang.Object
  extended by com.jivesoftware.forum.nntp.spi.MimeTools

public class MimeTools
extends java.lang.Object

Pure MIME related tools.


Nested Class Summary
static class MimeTools.Header
          Data structure containing a single header name/value pair.
static class MimeTools.Headers
          Contains the parsed article information.
 
Field Summary
static java.lang.String EXTRA_HEADER_PROP_PREFIX
          Message property prefix for extra headers
 
Method Summary
static java.lang.String detectUuencodedStart(java.lang.String line)
          Locates the start of a uuencoded section.
static java.lang.String getMIMEBoundary(java.lang.String contentType)
          Obtain the MIME boundary string if one exists.
static java.nio.charset.Charset getMIMECharset(java.lang.String contentType)
          Obtain the charset for a MIME part if one exists.
static java.lang.String getMIMEName(java.lang.String contentType)
          Obtain the MIME name for a MIME part if one exists.
static java.lang.String getMIMEType(java.lang.String contentType)
          Obtain the MIME type for a MIME part if one exists.
static MimeTools.Header parseHeader(java.lang.String header)
          Parse a single header for the name and value.
static MimeTools.Headers parseHeaders(java.util.Iterator headIter)
          Parses the headers from the list and returns a map of header to value fields in the map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXTRA_HEADER_PROP_PREFIX

public static final java.lang.String EXTRA_HEADER_PROP_PREFIX
Message property prefix for extra headers

See Also:
Constant Field Values
Method Detail

getMIMEType

public static final java.lang.String getMIMEType(java.lang.String contentType)
Obtain the MIME type for a MIME part if one exists. MIME parts missing a charset will return text/plain.

Parameters:
contentType - the Content-Type: header value.
Returns:
the MIME multipart boundary string, or null if none exists.

getMIMEName

public static final java.lang.String getMIMEName(java.lang.String contentType)
Obtain the MIME name for a MIME part if one exists. MIME parts missing a name will return the empty string.

Parameters:
contentType - the Content-Type: header value.
Returns:
the MIME multipart boundary string, or null if none exists.

getMIMEBoundary

public static final java.lang.String getMIMEBoundary(java.lang.String contentType)
Obtain the MIME boundary string if one exists. Non-multipart MIME messages will not use a boundary and this method will return null.

Parameters:
contentType - the Content-Type: header value.
Returns:
the MIME multipart boundary string, or null if none exists.

getMIMECharset

public static final java.nio.charset.Charset getMIMECharset(java.lang.String contentType)
Obtain the charset for a MIME part if one exists. MIME parts missing a charset will return ISO-8859-1.

Parameters:
contentType - the Content-Type: header value.
Returns:
the MIME multipart boundary string, or null if none exists.

parseHeaders

public static final MimeTools.Headers parseHeaders(java.util.Iterator headIter)

Parses the headers from the list and returns a map of header to value fields in the map. Headers present but empty, or not recognized will be ignored. Currently the parser cares only about the following headers:

We specifically ignore the following headers because they are determined by the session and are therefore forced to match Forum settings:

  • From: - determines the author, we don't let them override this.
  • Cc:/Bcc: - determines recipients. We're not a mail server.
  • Date: - server assign the date.
  • Message-ID: - server assigns the message id.
  • Any other headers (those not listed above) will be added to the headers map.

    Parameters:
    headIter - an iterator of the strings making up the raw article.
    Returns:
    the parsed information.

    detectUuencodedStart

    public static java.lang.String detectUuencodedStart(java.lang.String line)
    Locates the start of a uuencoded section. If the line is the start of a uuencoded section, the filename associated with the code is given.

    Parameters:
    line - the line to inspect for a uuencoded start marker.
    Returns:
    the filename associated with the uuencoded data to follow or null if the line is not a start marker.

    parseHeader

    public static final MimeTools.Header parseHeader(java.lang.String header)
    Parse a single header for the name and value. Header lines are non-whitespace characters creating the header name followed by a ':' character, one whitespace character, then the value of the header.

    Parameters:
    header - the header line to parse.
    Returns:
    the parsed header.

    Jive Forums Project Page

    Copyright © 1999-2006 Jive Software.