⇒ Index (Frames) |  ⇒ Index (No Frames) |  ⇒ Package |  ⇒ Package Tree |  ⇒ Full Tree 
gnu.mail.handler

Class Message

java.lang.Object
|
+--gnu.mail.handler.Message

All Implemented Interfaces:
DataContentHandler

Known Direct Subclasses:
MessageRFC822


public abstract class Message
extends java.lang.Object
implements DataContentHandler

A JAF data content handler for the message/* family of MIME content types.

Field Summary

DataFlavor

flavor

Our favorite data flavor.

Constructor Summary

Message(String mimeType, String description)

Constructor specifying the data flavor.

Method Summary

Object

getContent(DataSource source)

Return an object representing the data in its most preferred form.

Object

getTransferData(DataFlavor flavor, DataSource source)

Returns an object which represents the data to be transferred.

DataFlavor[]

getTransferDataFlavors()

Returns an array of DataFlavor objects indicating the flavors the data can be provided in.

void

writeTo(Object object, String mimeType, OutputStream out)

Convert the object to a byte stream of the specified MIME type and write it to the output stream.

Field Details

flavor

protected DataFlavor flavor

Our favorite data flavor.

Constructor Details

Message

protected Message(String mimeType, String description)

Constructor specifying the data flavor.

Parameters:
mimeType - the MIME content type
description - the description of the content type

Method Details

getContent

public Object getContent(DataSource source)

Return an object representing the data in its most preferred form. Generally this will be the form described by the first data flavor returned by the getTransferDataFlavors method.

Parameters:
source - the data source representing the data to be converted
Returns:
a message

getTransferData

public Object getTransferData(DataFlavor flavor, DataSource source)

Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.

Parameters:
flavor - the data flavor representing the requested type
source - the data source representing the data to be converted
Returns:
the constructed object

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()

Returns an array of DataFlavor objects indicating the flavors the data can be provided in.

Returns:
the DataFlavors

writeTo

public void writeTo(Object object, String mimeType, OutputStream out)

Convert the object to a byte stream of the specified MIME type and write it to the output stream.

Parameters:
object - the object to be converted
mimeType - the requested MIME content type to write as
out - the output stream into which to write the converted object