|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
java.awt.datatransfer.DataFlavor
, Serializable
, Cloneable

public class DataFlavor

, Cloneable

Each instance represents the opaque concept of a data format as would appear on a clipboard, during drag and drop, or in a file system.
DataFlavor objects are constant and never change once
instantiated.
For information on using data transfer with Swing, see How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.
| Field Summary | |
|---|---|
static DataFlavor |
imageFlavor
The DataFlavor representing a Java Image class,
where: |
static DataFlavor |
javaFileListFlavor
To transfer a list of files to/from Java (and the underlying platform) a DataFlavor of this type/subtype and
representation class of java.util.List is used. |
static String |
javaJVMLocalObjectMimeType
To transfer a reference to an arbitrary Java object reference that has no associated MIME Content-type, across a Transferable
interface WITHIN THE SAME JVM, a DataFlavor
with this type/subtype is used, with a representationClass
equal to the type of the class/interface being passed across the
Transferable. |
static String |
javaRemoteObjectMimeType
In order to pass a live link to a Remote object via a Drag and Drop ACTION_LINK operation a Mime Content Type of
application/x-java-remote-object should be used,
where the representation class of the DataFlavor
represents the type of the Remote interface to be
transferred. |
static String |
javaSerializedObjectMimeType
A MIME Content-Type of application/x-java-serialized-object represents a graph of Java object(s) that have been made persistent. |
static DataFlavor |
plainTextFlavor
Deprecated. as of 1.3. Use DataFlavor.getReaderForText(Transferable)
instead of Transferable.getTransferData(DataFlavor.plainTextFlavor). |
static DataFlavor |
stringFlavor
The DataFlavor representing a Java Unicode String class,
where: |
| Constructor Summary | |
|---|---|
DataFlavor
Constructs a new DataFlavor. |
|
DataFlavor
Constructs a DataFlavor that represents a Java class. |
|
DataFlavor
Constructs a DataFlavor from a mimeType string. |
|
DataFlavor
Constructs a DataFlavor that represents a
MimeType. |
|
DataFlavor
Constructs a DataFlavor that represents a
MimeType. |
|
| Method Summary | |
|---|---|
Object |
clone
Returns a clone of this DataFlavor. |
boolean |
equals
Tests a DataFlavor to this DataFlavor for
equality. |
boolean |
equals
Tests an arbitrary Object to this DataFlavor
for equality. |
boolean |
equals
Deprecated. As inconsistent with hashCode() contract,
use isMimeTypeEqual(String) instead. |
Class |
getDefaultRepresentationClass
|
String |
getDefaultRepresentationClassAsString
|
String |
getHumanPresentableName
Returns the human presentable name for the data format that this DataFlavor represents. |
String |
getMimeType
Returns the MIME type string for this DataFlavor. |
String |
getParameter
Returns the human presentable name for this DataFlavor
if paramName equals "humanPresentableName". |
String |
getPrimaryType
Returns the primary MIME type for this DataFlavor. |
Reader |
getReaderForText
Gets a Reader for a text flavor, decoded, if necessary, for the expected charset (encoding). |
Class |
getRepresentationClass
Returns the Class which objects supporting this
DataFlavor will return when this DataFlavor
is requested. |
String |
getSubType
Returns the sub MIME type of this DataFlavor. |
static DataFlavor |
getTextPlainUnicodeFlavor
Returns a DataFlavor representing plain text with Unicode
encoding, where: |
int |
hashCode
Returns hash code for this DataFlavor. |
boolean |
isFlavorJavaFileListType
Returns true if the DataFlavor specified represents
a list of file objects. |
boolean |
isFlavorRemoteObjectType
Returns true if the DataFlavor specified represents
a remote object. |
boolean |
isFlavorSerializedObjectType
Returns true if the DataFlavor specified represents
a serialized object. |
boolean |
isFlavorTextType
Returns whether this DataFlavor is a valid text flavor for
this implementation of the Java platform. |
boolean |
isMimeTypeEqual
Compares the mimeType of two DataFlavor
objects. |
boolean |
isMimeTypeEqual
Returns whether the string representation of the MIME type passed in is equivalent to the MIME type of this DataFlavor. |
boolean |
isMimeTypeSerializedObject
Does the DataFlavor represent a serialized object? |
boolean |
isRepresentationClassByteBuffer
Returns whether the representation class for this DataFlavor is java.nio.ByteBuffer or a
subclass thereof. |
boolean |
isRepresentationClassCharBuffer
Returns whether the representation class for this DataFlavor is java.nio.CharBuffer or a
subclass thereof. |
boolean |
isRepresentationClassInputStream
Does the DataFlavor represent a
java.io.InputStream? |
boolean |
isRepresentationClassReader
Returns whether the representation class for this DataFlavor is java.io.Reader or a subclass
thereof. |
boolean |
isRepresentationClassRemote
Returns true if the representation class is Remote. |
boolean |
isRepresentationClassSerializable
Returns true if the representation class can be serialized. |
boolean |
match
Tests a DataFlavor to this DataFlavor for
equality. |
protected String |
normalizeMimeType
Deprecated. |
protected String |
normalizeMimeTypeParameter
Deprecated. |
void |
readExternal
Restores this DataFlavor from a Serialized state. |
static DataFlavor |
selectBestTextFlavor
Selects the best text DataFlavor from an array of
DataFlavors. |
void |
setHumanPresentableName
Sets the human presentable name for the data format that this DataFlavor represents. |
String |
toString
String representation of this DataFlavor and its
parameters. |
protected static Class |
tryToLoadClass
Tries to load a class from: the bootstrap loader, the system loader, the context loader (if one is present) and finally the loader specified. |
void |
writeExternal
Serializes this DataFlavor. |
Methods inherited from class java.lang.Object ![]() |
|---|
finalize |
| Field Detail |
|---|

public static final DataFlavor![]()
![]()
stringFlavor
DataFlavor representing a Java Unicode String class,
where:
representationClass = java.lang.String
mimeType = "application/x-java-serialized-object"

public static final DataFlavor![]()
![]()
imageFlavor
DataFlavor representing a Java Image class,
where:
representationClass = java.awt.Image
mimeType = "image/x-java-image"

@Deprecated public static final DataFlavor![]()
![]()
plainTextFlavor
DataFlavor.getReaderForText(Transferable)
instead of Transferable.getTransferData(DataFlavor.plainTextFlavor).DataFlavor representing plain text with Unicode
encoding, where:
representationClass = InputStream
mimeType = "text/plain; charset=unicode"
This DataFlavor has been deprecated because
(1) Its representation is an InputStream, an 8-bit based representation,
while Unicode is a 16-bit character set; and (2) The charset "unicode"
is not well-defined. "unicode" implies a particular platform's
implementation of Unicode, not a cross-platform implementation.

public static final String![]()
![]()
javaSerializedObjectMimeType
DataFlavor
identifies the Java type of an object returned as a reference
from an invocation java.awt.datatransfer.getTransferData.

public static final DataFlavor![]()
![]()
javaFileListFlavor
DataFlavor of this type/subtype and
representation class of java.util.List is used.
Each element of the list is required/guaranteed to be of type
java.io.File.

public static final String![]()
![]()
javaJVMLocalObjectMimeType
Transferable
interface WITHIN THE SAME JVM, a DataFlavor
with this type/subtype is used, with a representationClass
equal to the type of the class/interface being passed across the
Transferable.
The object reference returned from
Transferable.getTransferData for a DataFlavor
with this MIME Content-Type is required to be
an instance of the representation Class of the DataFlavor.

public static final String![]()
![]()
javaRemoteObjectMimeType
ACTION_LINK operation a Mime Content Type of
application/x-java-remote-object should be used,
where the representation class of the DataFlavor
represents the type of the Remote interface to be
transferred.
| Constructor Detail |
|---|

public DataFlavor()
DataFlavor. This constructor is
provided only for the purpose of supporting the
Externalizable interface. It is not
intended for public (client) use.

public DataFlavor(Class![]()
![]()
<?> representationClass, String
![]()
![]()
humanPresentableName)
DataFlavor that represents a Java class.
The returned DataFlavor will have the following
characteristics:
representationClass = representationClass
mimeType = application/x-java-serialized-object
representationClass - the class used to transfer data in this flavorhumanPresentableName - the human-readable string used to identify
this flavor; if this parameter is null
then the value of the the MIME Content Type is used
NullPointerException

- if representationClass is null

public DataFlavor(String![]()
![]()
mimeType, String
![]()
![]()
humanPresentableName)
DataFlavor that represents a
MimeType.
The returned DataFlavor will have the following
characteristics:
If the mimeType is
"application/x-java-serialized-object; class=<representation class>",
the result is the same as calling
new DataFlavor(Class:forName(<representation class>).
Otherwise:
representationClass = InputStream
mimeType = mimeType
mimeType - the string used to identify the MIME type for this flavor;
if the the mimeType does not specify a
"class=" parameter, or if the class is not successfully
loaded, then an IllegalArgumentException
is thrownhumanPresentableName - the human-readable string used to identify
this flavor; if this parameter is null
then the value of the the MIME Content Type is used
IllegalArgumentException

- if mimeType is
invalid or if the class is not successfully loaded
NullPointerException

- if mimeType is null

public DataFlavor(String![]()
![]()
mimeType, String
![]()
![]()
humanPresentableName, ClassLoader
![]()
![]()
classLoader) throws ClassNotFoundException
![]()
![]()
DataFlavor that represents a
MimeType.
The returned DataFlavor will have the following
characteristics:
If the mimeType is
"application/x-java-serialized-object; class=<representation class>",
the result is the same as calling
new DataFlavor(Class:forName(<representation class>).
Otherwise:
representationClass = InputStream
mimeType = mimeType
mimeType - the string used to identify the MIME type for this flavorhumanPresentableName - the human-readable string used to
identify this flavorclassLoader - the class loader to use
ClassNotFoundException

- if the class is not loaded
IllegalArgumentException

- if mimeType is
invalid
NullPointerException

- if mimeType is null

public DataFlavor(String![]()
![]()
mimeType) throws ClassNotFoundException
![]()