java.lang.Object
gnu.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.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
flavor
protected java.awt.datatransfer.DataFlavor flavor
- Our favorite data flavor.
Yum yum.
Text
protected Text(java.lang.String mimeType,
java.lang.String description)
- Constructor specifying the data flavor.
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".