org.apache.james.mime4j.descriptor
Class DefaultBodyDescriptor

java.lang.Object
  extended by org.apache.james.mime4j.descriptor.DefaultBodyDescriptor
All Implemented Interfaces:
BodyDescriptor, ContentDescriptor, MutableBodyDescriptor
Direct Known Subclasses:
MaximalBodyDescriptor

public class DefaultBodyDescriptor
extends java.lang.Object
implements MutableBodyDescriptor

Encapsulates the values of the MIME-specific header fields (which starts with Content-).


Constructor Summary
DefaultBodyDescriptor()
          Creates a new root BodyDescriptor instance.
DefaultBodyDescriptor(BodyDescriptor parent)
          Creates a new BodyDescriptor instance.
 
Method Summary
 void addField(Field field)
          Should be called for each Content- header field of a MIME message or part.
 java.lang.String getBoundary()
          Return the boundary
 java.lang.String getCharset()
          Return the charset
 long getContentLength()
          Returns the body descriptors content-length.
 java.util.Map<java.lang.String,java.lang.String> getContentTypeParameters()
          Return all parameters for the BodyDescriptor
 java.lang.String getMediaType()
          Gets the defaulted MIME media type for this content.
 java.lang.String getMimeType()
          Return the MimeType
 java.lang.String getSubType()
          Gets the defaulted MIME sub type for this content.
 java.lang.String getTransferEncoding()
          Return the TransferEncoding
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultBodyDescriptor

public DefaultBodyDescriptor()
Creates a new root BodyDescriptor instance.


DefaultBodyDescriptor

public DefaultBodyDescriptor(BodyDescriptor parent)
Creates a new BodyDescriptor instance.

Parameters:
parent - the descriptor of the parent or null if this is the root descriptor.
Method Detail

addField

public void addField(Field field)
Should be called for each Content- header field of a MIME message or part.

Specified by:
addField in interface MutableBodyDescriptor
Parameters:
field - the MIME field.

getMimeType

public java.lang.String getMimeType()
Return the MimeType

Specified by:
getMimeType in interface ContentDescriptor
Returns:
mimeType
See Also:
ContentDescriptor.getMediaType(), ContentDescriptor.getSubType()

getBoundary

public java.lang.String getBoundary()
Return the boundary

Specified by:
getBoundary in interface BodyDescriptor
Returns:
boundary

getCharset

public java.lang.String getCharset()
Return the charset

Specified by:
getCharset in interface ContentDescriptor
Returns:
charset

getContentTypeParameters

public java.util.Map<java.lang.String,java.lang.String> getContentTypeParameters()
Return all parameters for the BodyDescriptor

Specified by:
getContentTypeParameters in interface ContentDescriptor
Returns:
parameters

getTransferEncoding

public java.lang.String getTransferEncoding()
Return the TransferEncoding

Specified by:
getTransferEncoding in interface ContentDescriptor
Returns:
transferEncoding

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getContentLength

public long getContentLength()
Description copied from interface: ContentDescriptor
Returns the body descriptors content-length.

Specified by:
getContentLength in interface ContentDescriptor
Returns:
Content length, if known, or -1, to indicate the absence of a content-length header.

getMediaType

public java.lang.String getMediaType()
Description copied from interface: ContentDescriptor
Gets the defaulted MIME media type for this content. For example TEXT, IMAGE, MULTIPART

Specified by:
getMediaType in interface ContentDescriptor
Returns:
the MIME media type when content-type specified, otherwise the correct default (TEXT)
See Also:
ContentDescriptor.getMimeType()

getSubType

public java.lang.String getSubType()
Description copied from interface: ContentDescriptor
Gets the defaulted MIME sub type for this content.

Specified by:
getSubType in interface ContentDescriptor
Returns:
the MIME media type when content-type is specified, otherwise the correct default (PLAIN)
See Also:
ContentDescriptor.getMimeType()


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.