| java.lang.Object java.awt.datatransfer.DataFlavor
DataFlavor | public class DataFlavor implements Externalizable,Cloneable(Code) | | 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.
version: 1.53, 02/09/01 author: Blake Sullivan author: Laurence P. G. Cable author: Jeff Dunn |
Field Summary | |
transient int | atom | MimeType | mimeType | final public static DataFlavor | plainTextFlavor The 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. | final public static DataFlavor | stringFlavor |
Method Summary | |
public Object | clone() | public boolean | equals(Object o) If the object is an instance of DataFlavor, representationClass
and MIME type will be compared. | public boolean | equals(DataFlavor that) Two DataFlavors are considered equal if and only if their
MIME primary type and subtype and representation class are
equal. | public String | getHumanPresentableName() Returns the human presentable name for the data foramt that this
DataFlavor represents. | public String | getMimeType() | public String | getPrimaryType() Returns the primary MIME type for this DataFlavor . | public Class | getRepresentationClass() Returns the Class which objects supporting this DataFlavor
will return when this DataFlavor is requested. | public String | getSubType() Returns the sub MIME type of this DataFlavor . | public int | hashCode() Returns hash code for this DataFlavor .
For two equal DataFlavors, hash codes are equal. | public boolean | isMimeTypeEqual(String mimeType) Returns whether the string representation of the MIME type passed in
is equivalent to the MIME type of this DataFlavor .
Parameters are not incuded in the comparison. | final public boolean | isMimeTypeEqual(DataFlavor dataFlavor) | public boolean | match(DataFlavor that) Two DataFlavors match if their primary types, subtypes,
and representation classes are all equal. | protected String | normalizeMimeType(String mimeType) Called for each MIME type string to give DataFlavor subtypes the
opportunity to change how the normalization of MIME types is accomplished. | protected String | normalizeMimeTypeParameter(String parameterName, String parameterValue) Called on DataFlavor for every MIME Type parameter to allow DataFlavor
subclasses to handle special parameters like the text/plain charset
parameters, whose values are case insensitive. | public synchronized void | readExternal(ObjectInput is) | public void | setHumanPresentableName(String humanPresentableName) Sets the human presentable name for the data format that this
DataFlavor represents. | public String | toString() String representation of this DataFlavor
and its parameters. | public synchronized void | writeExternal(ObjectOutput os) |
plainTextFlavor | final public static DataFlavor plainTextFlavor(Code) | | The 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.
|
stringFlavor | final public static DataFlavor stringFlavor(Code) | | The DataFlavor representing a Java Unicode String class, where:
representationClass = java.lang.String
mimeType = "application/x-java-serialized-object"
|
DataFlavor | public DataFlavor()(Code) | | Constructs a new DataFlavor. This constructor is provided only for
the purpose of supporting the Externalizable interface. It is not
intended for public (client) use.
since: 1.2 |
DataFlavor | DataFlavor(DataFlavor that)(Code) | | Cloning constructor. Package-private.
|
DataFlavor | public DataFlavor(Class representationClass, String humanPresentableName)(Code) | | Construct a DataFlavor that represents a Java class
The returned DataFlavor will have the following characteristics
representationClass = representationClass
mimeType = application/x-java-serialized-object
Parameters: representationClass - the class used to transfer data in this flavor Parameters: humanPresentableName - 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. |
DataFlavor | public DataFlavor(String mimeType, String humanPresentableName)(Code) | | Construct a 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>) as above
otherwise:
representationClass = InputStream
mimeType = mimeType
Parameters: 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 successfullyloaded, then an IllegalArgumentException is thrown. Parameters: humanPresentableName - 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. |
equals | public boolean equals(Object o)(Code) | | If the object is an instance of DataFlavor, representationClass
and MIME type will be compared.
This method does not use equals(String) method, so it does not
return true for the objects of String type.
if the objects are equal |
equals | public boolean equals(DataFlavor that)(Code) | | Two DataFlavors are considered equal if and only if their
MIME primary type and subtype and representation class are
equal. Additionally, if the primary type is "text", the
charset parameter must also be equal. If
either DataFlavor is of primary type "text", but no charset
is specified, the platform default charset is assumed for
that DataFlavor.
if the DataFlavors represent exactly the same type. |
getHumanPresentableName | public String getHumanPresentableName()(Code) | | Returns the human presentable name for the data foramt that this
DataFlavor represents. This name would be localized for different
countries
|
getMimeType | public String getMimeType()(Code) | | Returns the MIME type string for this DataFlavor
|
getPrimaryType | public String getPrimaryType()(Code) | | Returns the primary MIME type for this DataFlavor .
the primary MIME type of this DataFlavor |
getRepresentationClass | public Class getRepresentationClass()(Code) | | Returns the Class which objects supporting this DataFlavor
will return when this DataFlavor is requested.
|
getSubType | public String getSubType()(Code) | | Returns the sub MIME type of this DataFlavor .
the Sub MIME type of this DataFlavor |
hashCode | public int hashCode()(Code) | | Returns hash code for this DataFlavor .
For two equal DataFlavors, hash codes are equal. For the String
that matches DataFlavor.equals(String) , it is not
guaranteed that DataFlavor's hash code is equal to the hash code
of the String.
a hash code for this DataFlavor |
isMimeTypeEqual | public boolean isMimeTypeEqual(String mimeType)(Code) | | Returns whether the string representation of the MIME type passed in
is equivalent to the MIME type of this DataFlavor .
Parameters are not incuded in the comparison. The comparison may involve
adding default attributes for some MIME types (such as adding
charset=US-ASCII to text/plain MIME types that have
no charset parameter specified).
Parameters: mimeType - the string representation of the MIME type true if the string representation of the MIME type passed in isequivalent to the MIME type of this DataFlavor ;false otherwise. throws: NullPointerException - if mimeType is null |
isMimeTypeEqual | final public boolean isMimeTypeEqual(DataFlavor dataFlavor)(Code) | | Compare the mimeType of two DataFlavor objects
no parameters are considered
if the MimeTypes are equal |
match | public boolean match(DataFlavor that)(Code) | | Two DataFlavors match if their primary types, subtypes,
and representation classes are all equal. Additionally, if
the primary type is "text", the charset parameter is also
considered. If either DataFlavor is of primary type "text",
but no charset is specified, the platform default charset
is assumed for that DataFlavor.
|
normalizeMimeType | protected String normalizeMimeType(String mimeType)(Code) | | Called for each MIME type string to give DataFlavor subtypes the
opportunity to change how the normalization of MIME types is accomplished.
One possible use would be to add default parameter/value pairs in cases
where none are present in the MIME type string passed in
This method is never invoked by this implementation from 1.1 onwards
|
normalizeMimeTypeParameter | protected String normalizeMimeTypeParameter(String parameterName, String parameterValue)(Code) | | Called on DataFlavor for every MIME Type parameter to allow DataFlavor
subclasses to handle special parameters like the text/plain charset
parameters, whose values are case insensitive. (MIME type parameter
values are supposed to be case sensitive.
This method is called for each parameter name/value pair and should
return the normalized representation of the parameterValue
This method is never invoked by this implementation from 1.1 onwards
|
setHumanPresentableName | public void setHumanPresentableName(String humanPresentableName)(Code) | | Sets the human presentable name for the data format that this
DataFlavor represents. This name would be localized for different
countries
|
toString | public String toString()(Code) | | String representation of this DataFlavor
and its parameters. The result String contains name of
DataFlavor class, representation class
and Mime type of this Flavor.
string representation of this DataFlavor |
|
|