public class DataHandler
extends java.lang.Object
implements java.awt.datatransfer.Transferable
Constructor and Description |
---|
DataHandler(DataSource ds)
Constructor in which the data is read from a data source.
|
DataHandler(java.lang.Object obj,
java.lang.String mimeType)
Constructor using a reified object representation.
|
DataHandler(java.net.URL url)
Constructor in which the data is read from a URL.
|
Modifier and Type | Method and Description |
---|---|
CommandInfo[] |
getAllCommands()
Returns the complete list of commands for this type of data.
|
java.lang.Object |
getBean(CommandInfo cmdInfo)
Returns the instantiated bean using the specified command.
|
CommandInfo |
getCommand(java.lang.String cmdName)
Returns the specified command.
|
java.lang.Object |
getContent()
Returns the data as a reified object.
|
java.lang.String |
getContentType()
Returns the MIME type of the data (with parameters).
|
DataSource |
getDataSource()
Returns the data source from which data is read.
|
java.io.InputStream |
getInputStream()
Returns an input stream from which the data can be read.
|
java.lang.String |
getName()
Returns the name of the data object if created with a DataSource.
|
java.io.OutputStream |
getOutputStream()
Returns an output stream that can be used to overwrite the underlying
data, if the DataSource constructor was used.
|
CommandInfo[] |
getPreferredCommands()
Returns the preferred commands for this type of data.
|
java.lang.Object |
getTransferData(java.awt.datatransfer.DataFlavor flavor)
Returns an object representing the data to be transferred.
|
java.awt.datatransfer.DataFlavor[] |
getTransferDataFlavors()
Returns the data flavors in which this data is available.
|
boolean |
isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
Indicates whether the specified data flavor is supported for this
data.
|
void |
setCommandMap(CommandMap commandMap)
Sets the command map to be used by this data handler.
|
static void |
setDataContentHandlerFactory(DataContentHandlerFactory newFactory)
Sets the data content handler factory.
|
void |
writeTo(java.io.OutputStream os)
Writes the data as a byte stream.
|
public DataHandler(DataSource ds)
ds
- the data sourcepublic DataHandler(java.lang.Object obj, java.lang.String mimeType)
obj
- the object representation of the datamimeType
- the MIME type of the objectpublic DataHandler(java.net.URL url)
url
- the URLpublic DataSource getDataSource()
public java.lang.String getName()
public java.lang.String getContentType()
public java.io.InputStream getInputStream() throws java.io.IOException
java.io.IOException
public void writeTo(java.io.OutputStream os) throws java.io.IOException
os
- the stream to write tojava.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
java.io.IOException
public java.awt.datatransfer.DataFlavor[] getTransferDataFlavors()
getTransferDataFlavors
in interface java.awt.datatransfer.Transferable
public boolean isDataFlavorSupported(java.awt.datatransfer.DataFlavor flavor)
isDataFlavorSupported
in interface java.awt.datatransfer.Transferable
public java.lang.Object getTransferData(java.awt.datatransfer.DataFlavor flavor) throws java.awt.datatransfer.UnsupportedFlavorException, java.io.IOException
getTransferData
in interface java.awt.datatransfer.Transferable
flavor
- the requested data flavorjava.awt.datatransfer.UnsupportedFlavorException
java.io.IOException
public void setCommandMap(CommandMap commandMap)
commandMap
- the command map to usepublic CommandInfo[] getPreferredCommands()
public CommandInfo[] getAllCommands()
public CommandInfo getCommand(java.lang.String cmdName)
cmdName
- the command namepublic java.lang.Object getContent() throws java.io.IOException
java.io.IOException
public java.lang.Object getBean(CommandInfo cmdInfo)
cmdInfo
- the command to instantiate the bean withpublic static void setDataContentHandlerFactory(DataContentHandlerFactory newFactory)
newFactory
- the factory to set