org.apache.geronimo.javamail.handlers
Class AbstractTextHandler
java.lang.Object
org.apache.geronimo.javamail.handlers.AbstractTextHandler
- All Implemented Interfaces:
- DataContentHandler
- Direct Known Subclasses:
- TextHtmlHandler, TextPlainHandler, TextXmlHandler
public class AbstractTextHandler
- extends Object
- implements DataContentHandler
- Version:
- $Rev: 669902 $ $Date: 2008-06-20 10:04:41 -0400 (Fri, 20 Jun 2008) $
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractTextHandler
public AbstractTextHandler(DataFlavor flavour)
getTransferDataFlavors
public DataFlavor[] getTransferDataFlavors()
- Specified by:
getTransferDataFlavors
in interface DataContentHandler
getTransferData
public Object getTransferData(DataFlavor dataFlavor,
DataSource dataSource)
throws UnsupportedFlavorException,
IOException
- Specified by:
getTransferData
in interface DataContentHandler
- Throws:
UnsupportedFlavorException
IOException
getContent
public Object getContent(DataSource ds)
throws IOException
- Read the content from the DataSource and transform
it into a text object (String).
- Specified by:
getContent
in interface DataContentHandler
- Parameters:
ds
- The source DataSource.
- Returns:
- The content object.
- Throws:
IOException
writeTo
public void writeTo(Object o,
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 Exception
- get the character set from content type
- Parameters:
contentType
-
- Returns:
-
- Throws:
ParseException
Exception
Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.