Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.james.mime4j.message
Class Entity

    java.lang.Object
      org.apache.james.mime4j.message.Entity

All Implemented Interfaces:
  Disposable

Direct Known Subclasses:
  BodyPart, Message

    public abstract class Entity

extends java.lang.Object
implements Disposable

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
`void` | `dispose()` Disposes the body of this entity.
`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` - compatibility mode: `MessageUtils.LENIENT`, `MessageUtils.STRICT_ERROR`, `MessageUtils.STRICT_IGNORE`
  Throws:
    `java.io.IOException`
    `MimeException`

### dispose

    public void dispose()

  Disposes the body of this entity. Note that the dispose call does not get forwarded to the parent entity of this Entity. Subclasses that need to free resources should override this method and invoke super.dispose().

  Specified by:
    `dispose` in interface `Disposable`
  See Also:
    `Disposable.dispose()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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