public class DataHandler; extends ; implements erable. The DataHandler class provides a consistent interface to. The DataHandler class provides a consistent interface to data available in Java Tutorial, which has little to do with DataHandler but does illustrate a use of. When sending a text file, an XML file or a object (String) as.

Author: Dolar Zulkilar
Country: Dominican Republic
Language: English (Spanish)
Genre: Personal Growth
Published (Last): 14 August 2014
Pages: 441
PDF File Size: 13.33 Mb
ePub File Size: 2.4 Mb
ISBN: 584-9-43379-870-9
Downloads: 25857
Price: Free* [*Free Regsitration Required]
Uploader: Mitaur

DataHandler and the Transferable Interface DataHandler implements the Transferable interface so that data can be used in AWT data transfer operations, such as cut and paste and drag and drop.

The implementation of the Transferable interface relies on the availability of an installed DataContentHandler object corresponding to the MIME type of the data represented in the specific instance of the DataHandler. See CommandMap for more information. Object getContent Return the data in its preferred Object form. String getName Return the name of the data object. datayandler

CommandInfo [] getPreferredCommands Return the preferred commands for this type of data. The data exists in a byte stream form.

The DataSource will provide an InputStream to access the data. This constructor is used when the application already has an in-memory representation of the data in the form of a Java Object.

DataSources created for DataHandlers not instantiated with a DataSource are cached for performance jjava.

Note that this is the full type with parameters. If it is successful, it creates a pipe and a thread. The thread uses the DataContentHandler’s writeTo method to write the stream data into one end of the pipe. The other end of the pipe is returned to the caller. Because a thread is created to copy the data, IOExceptions that may occur during the copy can not be propagated back to the caller.


How to create Java objects for data to be sent

The result is an empty stream. Otherwise, null is returned. Returns an array of DataFlavor objects indicating the flavors the data can be provided in.

The array is usually ordered according to preference for providing the datahajdler, from most richly descriptive to least richly descriptive.

This method iterates through the DataFlavors returned from getTransferDataFlavorscomparing each with the specified flavor. The class of the object returned is defined by the representation class of the data flavor.

Class ndler

If one is found, the passed in DataFlavor and the type of the data are passed to its getTransferData method. InputStream class, this object’s InputStream is returned. Otherwise it throws an UnsupportedFlavorException. For DataHandler’s created hava Objects: Changing the CommandMap, or setting it to nullclears out any data cached from the previous CommandMap.

This method returns an array that represents a subset of available commands. In cases where multiple commands for the MIME type represented by this DataHandler are present, the installed CommandMap chooses the appropriate commands. This method returns an array containing all commands for the type of data represented by this DataHandler.

Use the search semantics as defined by the CommandMap installed in this DataHandler.

Class javax.activation.DataHandler

If the DataHandler was instantiated with an object, return the object. The DataContentHandlerFactory can only be set once.

Error – if the factory has already been defined. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.


Use is subject to license terms. Also see the documentation redistribution policy. DataHandler All Implemented Interfaces: Transferable public class DataHandler extends Object implements Transferable The DataHandler class provides a consistent interface to data available in many different sources and formats. It manages simple stream to string conversions and related operations datahanlder DataContentHandlers.

It provides access to commands that can operate on the data. The commands are found using a CommandMap. A convenience method that takes a CommandInfo object and instantiates the corresponding command, usually a JavaBean component. Get an OutputStream for this DataHandler to allow overwriting the underlying data.

Return the DataSource associated with this instance of DataHandler. Return the name of the data object.

Return the MIME type of this object as retrieved from the source object. Datahaneler the InputStream for this object.

Write the data to an OutputStream. Return the DataFlavors in which this data is available. Returns whether the specified data flavor is supported for this object. Returns an object that represents the data to be transferred. Set the CommandMap for use by this DataHandler.

Return the preferred commands for this type of data. Return all the commands for this type of data. Get the command cmdName. Return the data in its preferred Object form.