public class ByteArrayContentHandler extends Object implements DataContentHandler
Constructor and Description |
---|
ByteArrayContentHandler() |
Modifier and Type | Method and Description |
---|---|
Object |
getContent(DataSource dataSource)
Return an object representing the data in its most preferred form.
|
Object |
getTransferData(DataFlavor dataFlavor,
DataSource dataSource)
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 string,
OutputStream outputStream)
Convert the object to a byte stream of the specified MIME type
and write it to the output stream.
|
public Object getContent(DataSource dataSource) throws IOException
DataContentHandler
getTransferDataFlavors
method.getContent
in interface DataContentHandler
dataSource
- The DataSource representing the data to be converted.IOException
- if the data can't be accessedpublic Object getTransferData(DataFlavor dataFlavor, DataSource dataSource) throws UnsupportedFlavorException, IOException
DataContentHandler
getTransferData
in interface DataContentHandler
dataFlavor
- The DataFlavor representing the requested type.dataSource
- The DataSource representing the data to be converted.UnsupportedFlavorException
- if the handler doesn't
support the requested flavorIOException
- if the data can't be accessedpublic DataFlavor[] getTransferDataFlavors()
DataContentHandler
getTransferDataFlavors
in interface DataContentHandler
public void writeTo(Object object, String string, OutputStream outputStream) throws IOException
DataContentHandler
writeTo
in interface DataContentHandler
object
- The object to be converted.string
- The requested MIME type of the resulting byte stream.outputStream
- The output stream into which to write the converted
byte stream.IOException
- errors writing to the streamCopyright © 2013 JBoss by Red Hat. All Rights Reserved.