APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.awt.datatransfer

public Class ClipboardTransferable

extends Object
implements Transferable
Class Inheritance
All Implemented Interfaces
java.awt.datatransfer.Transferable
Imports
java.awt.datatransfer.DataFlavor, .Transferable, .UnsupportedFlavorException, java.io.IOException, java.util.HashMap, .Map

Reads all of the data from the system Clipboard which the data transfer subsystem knows how to translate. This includes all text data, File Lists, Serializable objects, Remote objects, and properly registered, arbitrary data as InputStreams. The data is stored in byte format until requested by client code. At that point, the data is converted, if necessary, into the proper format to deliver to the application. This hybrid pre-fetch/delayed-rendering approach allows us to circumvent the API restriction that client code cannot lock the Clipboard to discover its formats before requesting data in a particular format, while avoiding the overhead of fully rendering all data ahead of time.
Authors
David Mendenhall, Danila Sinopalnikov
Since
1.4 (appeared in modified form as FullyRenderedTransferable in 1.3.1)

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class

Field Summary

Modifier and TypeField and Description
private DataFlavor[]
private final Map<DataFlavor, Object>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private boolean
fetchOneFlavor(SunClipboard clipboard, DataFlavor flavor, long format, Map<Long, Object> cached_data)

public Object
getTransferData(DataFlavor flavor)

Implements java.awt.datatransfer.Transferable.getTransferData.

Returns an object which represents the data to be transferred.

public DataFlavor[]
getTransferDataFlavors()

Implements java.awt.datatransfer.Transferable.getTransferDataFlavors.

Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).

public boolean
isDataFlavorSupported(DataFlavor flavor)

Implements java.awt.datatransfer.Transferable.isDataFlavorSupported.

Returns whether or not the specified data flavor is supported for this object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

flavorsback to summary
private DataFlavor[] flavors
flavorsToDataback to summary
private final Map<DataFlavor, Object> flavorsToData

Constructor Detail

ClipboardTransferableback to summary
public ClipboardTransferable(SunClipboard clipboard)

Method Detail

fetchOneFlavorback to summary
private boolean fetchOneFlavor(SunClipboard clipboard, DataFlavor flavor, long format, Map<Long, Object> cached_data)
getTransferDataback to summary
public Object getTransferData(DataFlavor flavor) throws UnsupportedFlavorException, IOException

Implements java.awt.datatransfer.Transferable.getTransferData.

Doc from java.awt.datatransfer.Transferable.getTransferData.

Returns an object which represents the data to be transferred. The class of the object returned is defined by the representation class of the flavor.

Annotations
@Override
Exceptions
UnsupportedFlavorException:
if the requested data flavor is not supported
IOException:
if the data is no longer available in the requested flavor
getTransferDataFlavorsback to summary
public DataFlavor[] getTransferDataFlavors()

Implements java.awt.datatransfer.Transferable.getTransferDataFlavors.

Doc from java.awt.datatransfer.Transferable.getTransferDataFlavors.

Returns an array of DataFlavor objects indicating the flavors the data can be provided in. The array should be ordered according to preference for providing the data (from most richly descriptive to least descriptive).

Annotations
@Override
isDataFlavorSupportedback to summary
public boolean isDataFlavorSupported(DataFlavor flavor)

Implements java.awt.datatransfer.Transferable.isDataFlavorSupported.

Doc from java.awt.datatransfer.Transferable.isDataFlavorSupported.

Returns whether or not the specified data flavor is supported for this object.

Annotations
@Override
sun.awt.datatransfer back to summary

private final Class ClipboardTransferable.DataFactory

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final byte[]
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv
DataFactory(long format, byte[] data)

Method Summary

Modifier and TypeMethod and Description
public Object
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

databack to summary
pack-priv final byte[] data
formatback to summary
pack-priv final long format

Constructor Detail

DataFactoryback to summary
pack-priv DataFactory(long format, byte[] data)

Method Detail

getTransferDataback to summary
public Object getTransferData(DataFlavor flavor) throws IOException