Transfer provides a mechanism for converting between a java
representation of data and a platform specific representation of data and
vice versa. It is used in data transfer operations such as drag and drop and
clipboard copy/paste.
You should only need to become familiar with this class if you are implementing a Transfer subclass and you are unable to subclass the ByteArrayTransfer class.
ByteArrayTransfer, Drag and Drop snippets, SWT Example: DNDExample, Sample code and further information
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract TransferData[] | Returns: a list of the data types that can be converted using this transfer agentReturns a list of the platform specific data types that can be converted using this transfer agent. |
| protected abstract int[] | Returns: the platform specific ids of the data types that can be converted using this transfer agentReturns the platform specific ids of the data types that can be converted using this transfer agent. |
| protected abstract String[] | Returns: the platform specific names of the data types that can be converted using this transfer agent.Returns the platform specific names of the data types that can be converted using this transfer agent. |
| public abstract boolean | Returns: true if the transferData data type can be converted using this transfer agenta platform specific description of a data type; only the data
type fields of the transferData)TransferData object need to be filled inReturns true if the |
| protected abstract void | javaToNative(Object
a java representation of the data to be converted; the type of
Object that is passed in is dependent on the object, TransferData Transfer subclass.an empty TransferData object; this object will be
filled in on return with the platform specific representation of the data transferData)Converts a java representation of data to a platform specific representation of the data. |
| protected abstract Object | Returns: a java representation of the converted data if the conversion was successful; otherwise null. If transferData isnull then
null is returned. The type of Object that is returned is
dependent on the Transfer subclass.the platform specific representation of the data to be
converted transferData)Converts a platform specific representation of data to a java representation. |
| public static int | Returns: the unique identifier associated with this data typethe name of a data type formatName)Registers a name for a data type and returns the associated unique identifier. |
| protected boolean |
| Transfer | back to summary |
|---|---|
| public Transfer() | |
| getSupportedTypes | back to summary |
|---|---|
| public abstract TransferData[] getSupportedTypes() Returns a list of the platform specific data types that can be converted using this transfer agent. Only the data type fields of the
| |
| getTypeIds | back to summary |
|---|---|
| protected abstract int[] getTypeIds() Returns the platform specific ids of the data types that can be converted using this transfer agent.
| |
| getTypeNames | back to summary |
|---|---|
| protected abstract String[] getTypeNames() Returns the platform specific names of the data types that can be converted using this transfer agent.
| |
| isSupportedType | back to summary |
|---|---|
| public abstract boolean isSupportedType(TransferData transferData) Returns true if the
| |
| javaToNative | back to summary |
|---|---|
| protected abstract void javaToNative(Object object, TransferData transferData) Converts a java representation of data to a platform specific representation of the data. On a successful conversion, the transferData.result field will be set as follows:
If this transfer agent is unable to perform the conversion, the transferData.result field will be set to a failure value as follows:
| |
| nativeToJava | back to summary |
|---|---|
| protected abstract Object nativeToJava(TransferData transferData) Converts a platform specific representation of data to a java representation.
| |
| registerType | back to summary |
|---|---|
| public static int registerType(String formatName) Registers a name for a data type and returns the associated unique identifier. You may register the same type more than once, the same unique identifier will be returned if the type has been previously registered. Note On windows, do not call this method with pre-defined Clipboard Format types such as CF_TEXT or CF_BITMAP because the pre-defined identifier will not be returned
| |
| validate | back to summary |
|---|---|
| protected boolean validate(Object object) Test that the object is of the correct format for this Transfer class.
| |