Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.mail.handler
Class Text  view Text download Text.java

java.lang.Object
  extended bygnu.mail.handler.Text
All Implemented Interfaces:
javax.activation.DataContentHandler
Direct Known Subclasses:
TextHtml, TextPlain, TextXml

public abstract class Text
extends java.lang.Object
implements javax.activation.DataContentHandler

A JAF data content handler for the text/* family of MIME content types. This provides the basic behaviour for any number of text-handling subtypes which simply need to override their default constructor to provide the correct MIME content-type and description.


Field Summary
protected  java.awt.datatransfer.DataFlavor flavor
          Our favorite data flavor.
 
Constructor Summary
protected Text(java.lang.String mimeType, java.lang.String description)
          Constructor specifying the data flavor.
 
Method Summary
 java.lang.Object getContent(javax.activation.DataSource source)
          Return an object representing the data in its most preferred form.
protected static java.lang.String getJavaCharset(java.lang.String contentType)
          Returns the Java character set corresponding to the MIME charset parameter of the content type value.
 java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor, javax.activation.DataSource source)
          Returns an object which represents the data to be transferred.
 java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
          Returns an array of DataFlavor objects indicating the flavors the data can be provided in.
 void writeTo(java.lang.Object object, java.lang.String mimeType, java.io.OutputStream out)
          Convert the object to a byte stream of the specified MIME type and write it to the output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

flavor

protected java.awt.datatransfer.DataFlavor flavor
Our favorite data flavor. Yum yum.

Constructor Detail

Text

protected Text(java.lang.String mimeType,
               java.lang.String description)
Constructor specifying the data flavor.

Method Detail

getTransferDataFlavors

public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
Returns an array of DataFlavor objects indicating the flavors the data can be provided in.

Specified by:
getTransferDataFlavors in interface javax.activation.DataContentHandler

getTransferData

public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor,
                                        javax.activation.DataSource source)
                                 throws java.awt.datatransfer.UnsupportedFlavorException,
                                        java.io.IOException
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.

Specified by:
getTransferData in interface javax.activation.DataContentHandler

getContent

public java.lang.Object getContent(javax.activation.DataSource source)
                            throws java.io.IOException
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.

Specified by:
getContent in interface javax.activation.DataContentHandler

writeTo

public void writeTo(java.lang.Object object,
                    java.lang.String mimeType,
                    java.io.OutputStream out)
             throws java.io.IOException
Convert the object to a byte stream of the specified MIME type and write it to the output stream.

Specified by:
writeTo in interface javax.activation.DataContentHandler

getJavaCharset

protected static java.lang.String getJavaCharset(java.lang.String contentType)
Returns the Java character set corresponding to the MIME charset parameter of the content type value. The default value is the Java character set mapped to the MIME charset "us-ascii".