org.apache.geronimo.mail.handlers
Class TextHandler

java.lang.Object
  extended by org.apache.geronimo.mail.handlers.TextHandler
All Implemented Interfaces:
DataContentHandler
Direct Known Subclasses:
HtmlHandler, XMLHandler

public class TextHandler
extends Object
implements DataContentHandler


Constructor Summary
TextHandler()
           
TextHandler(ActivationDataFlavor dataFlavor)
          Constructor TextHandler
 
Method Summary
protected  String getCharSet(String contentType)
          get the character set from content type
 Object getContent(DataSource datasource)
          Method getContent
protected  ActivationDataFlavor getDF()
          Method getDF
 Object getTransferData(DataFlavor dataflavor, DataSource datasource)
          Method getTransferData
 DataFlavor[] getTransferDataFlavors()
          Method getTransferDataFlavors
 void writeTo(Object object, String contentType, OutputStream outputstream)
          Write an object of "our" type out to the provided output stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TextHandler

public TextHandler()

TextHandler

public TextHandler(ActivationDataFlavor dataFlavor)
Constructor TextHandler

Parameters:
dataFlavor -
Method Detail

getDF

protected ActivationDataFlavor getDF()
Method getDF

Returns:
dataflavor

getTransferDataFlavors

public DataFlavor[] getTransferDataFlavors()
Method getTransferDataFlavors

Specified by:
getTransferDataFlavors in interface DataContentHandler
Returns:
dataflavors

getTransferData

public Object getTransferData(DataFlavor dataflavor,
                              DataSource datasource)
                       throws IOException
Method getTransferData

Specified by:
getTransferData in interface DataContentHandler
Parameters:
dataflavor -
datasource -
Returns:
Throws:
IOException

getContent

public Object getContent(DataSource datasource)
                  throws IOException
Method getContent

Specified by:
getContent in interface DataContentHandler
Parameters:
datasource -
Returns:
Throws:
IOException

writeTo

public void writeTo(Object object,
                    String contentType,
                    OutputStream outputstream)
             throws IOException
Write an object of "our" type out to the provided output stream. The content type might modify the result based on the content type parameters.

Specified by:
writeTo in interface DataContentHandler
Parameters:
object - The object to write.
contentType - The content mime type, including parameters.
outputstream - The target output stream.
Throws:
IOException

getCharSet

protected String getCharSet(String contentType)
                     throws ParseException
get the character set from content type

Parameters:
contentType -
Returns:
Throws:
ParseException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.