org.apache.james.mime4j.message
Class Entity

java.lang.Object
  extended by org.apache.james.mime4j.message.Entity
Direct Known Subclasses:
BodyPart, Message

public abstract class Entity
extends java.lang.Object

MIME entity. An entity has a header and a body (see RFC 2045).

Version:
$Id: Entity.java,v 1.3 2004/10/02 12:41:11 ntherning Exp $

Constructor Summary
Entity()
           
 
Method Summary
 Body getBody()
          Gets the body of this entity.
 java.lang.String getCharset()
          Determines the MIME character set encoding of this Entity.
 java.lang.String getContentTransferEncoding()
          Determines the transfer encoding of this Entity.
 Header getHeader()
          Gets the entity header.
 java.lang.String getMimeType()
          Determines the MIME type of this Entity.
 Entity getParent()
          Gets the parent entity of this entity.
 boolean isMimeType(java.lang.String type)
          Determines if the MIME type of this Entity matches the given one.
 boolean isMultipart()
          Determines if the MIME type of this Entity is multipart/*.
 void setBody(Body body)
          Sets the body of this entity.
 void setHeader(Header header)
          Sets the entity header.
 void setParent(Entity parent)
          Sets the parent entity of this entity.
 void writeTo(java.io.OutputStream out, int mode)
          Write the content to the given outputstream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Entity

public Entity()
Method Detail

getParent

public Entity getParent()
Gets the parent entity of this entity. Returns null if this is the root entity.

Returns:
the parent or null.

setParent

public void setParent(Entity parent)
Sets the parent entity of this entity.

Parameters:
parent - the parent entity or null if this will be the root entity.

getHeader

public Header getHeader()
Gets the entity header.

Returns:
the header.

setHeader

public void setHeader(Header header)
Sets the entity header.

Parameters:
header - the header.

getBody

public Body getBody()
Gets the body of this entity.

Returns:
the body,

setBody

public void setBody(Body body)
Sets the body of this entity.

Parameters:
body - the body.

getMimeType

public java.lang.String getMimeType()
Determines the MIME type of this Entity. The MIME type is derived by looking at the parent's Content-Type field if no Content-Type field is set for this Entity.

Returns:
the MIME type.

getCharset

public java.lang.String getCharset()
Determines the MIME character set encoding of this Entity.

Returns:
the MIME character set encoding.

getContentTransferEncoding

public java.lang.String getContentTransferEncoding()
Determines the transfer encoding of this Entity.

Returns:
the transfer encoding.

isMimeType

public boolean isMimeType(java.lang.String type)
Determines if the MIME type of this Entity matches the given one. MIME types are case-insensitive.

Parameters:
type - the MIME type to match against.
Returns:
true on match, false otherwise.

isMultipart

public boolean isMultipart()
Determines if the MIME type of this Entity is multipart/*. Since multipart-entities must have a boundary parameter in the Content-Type field this method returns false if no boundary exists.

Returns:
true on match, false otherwise.

writeTo

public void writeTo(java.io.OutputStream out,
                    int mode)
             throws java.io.IOException,
                    MimeException
Write the content to the given outputstream

Parameters:
out - the outputstream to write to
mode - output mode MessageUtils
Throws:
java.io.IOException
MimeException


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