Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.datatransfer.DataFlavor

java.lang.Object
    |
    +----java.awt.datatransfer.DataFlavor

public class DataFlavor
extends Object
implements Serializable, 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.


Field Summary
static DataFlavor  plainTextFlavor
The DataFlavor representing plain text with unicode encoding, where:

representationClass = InputStream
mimeType = "text/plain; charset=unicode"

static DataFlavor  stringFlavor
The DataFlavor representing a Java Unicode String class, where:

representationClass = java.lang.String
mimeType = "application/x-java-serialized-object"

 

Constructor Summary
 DataFlavor(String primaryType, String subType, MimeTypeParameterList params, Class representationClass, String humanPresentableName)
Construct a fully specified DataFlavor
 DataFlavor(Class representationClass, String humanPresentableName)
Construct a DataFlavor that represents a Java class

The returned DataFlavor will have the following characteristics

representationClass = representationClass
mimeType = application/x-java-serialized-object

 DataFlavor(String mimeType, String humanPresentableName)
Construct a DataFlavor that represents a MimeType

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-javaserializedobject; class=<representation class>", the result is the same as calling new DataFlavor(Class:forName(<representation class>) as above

otherwise:

representationClass = InputStream
mimeType = mimeType

 DataFlavor(String mimeType)
construct a DataFlavor from a Mime Type string.
 DataFlavor()
 
 

Method Summary
Object  clone()
 
boolean  equals(Object o)
 
boolean  equals(MimeType mt)
 
boolean  equals(DataFlavor dataFlavor)
 
boolean  equals(String s)
 
String  getHumanPresentableName()
Returns the human presentable name for the data foramt that this DataFlavor represents.
String  getMimeType()
Returns the MIME type string for this DataFlavor
String  getParameter(String paramName)
 
String  getPrimaryType()
 
Class  getRepresentationClass()
Returns the Class which objects supporting this DataFlavor will return when this DataFlavor is requested.
String  getSubType()
 
boolean  isMimeTypeEqual(String mimeType)
Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor.
boolean  isMimeTypeEqual(DataFlavor dataFlavor)
 
boolean  isMimeTypeEqual(MimeType mtype)
 
boolean  isMimeTypeSerializedObject()
does the DataFlavor represent a serialized object?
boolean  isRepresentationClassInputStream()
does the DataFlavor represent a serialized object?
boolean  isRepresentationClassSerializable()
 
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.
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.
void  readObject(ObjectInputStream ois)
restore this DataFlavor from an Serialized state
void  setHumanPresentableName(String humanPresentableName)
Sets the human presentable name for the data format that this DataFlavor represents.
void  writeObject(ObjectOutputStream oos)
Serialize this DataFlavor
 
Methods inherited from class java.lang.Object
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stringFlavor

public static final DataFlavor stringFlavor
The DataFlavor representing a Java Unicode String class, where:

representationClass = java.lang.String
mimeType = "application/x-java-serialized-object"


plainTextFlavor

public static final DataFlavor plainTextFlavor
The DataFlavor representing plain text with unicode encoding, where:

representationClass = InputStream
mimeType = "text/plain; charset=unicode"

Constructor Detail

DataFlavor

public DataFlavor(String primaryType,
                  String subType,
                  MimeTypeParameterList params,
                  Class representationClass,
                  String humanPresentableName)
Construct a fully specified DataFlavor

DataFlavor

public DataFlavor(Class representationClass,
                  String humanPresentableName)
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
humanPresentableName - the human-readible string used to identify this flavor

DataFlavor

public DataFlavor(String mimeType,
                  String humanPresentableName)
Construct a DataFlavor that represents a MimeType

The returned DataFlavor will have the following characteristics:

If the mimeType is "application/x-javaserializedobject; 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
humanPresentableName - the human-readible string used to identify this flavor

DataFlavor

public DataFlavor(String mimeType) throws MimeTypeParseException, ClassNotFoundException
construct a DataFlavor from a Mime Type string. The string must specify a "class=" parameter in order to succeed in constructing a DataFlavor.

DataFlavor

public DataFlavor()
Method Detail

getMimeType

public String getMimeType()
Returns the MIME type string for this DataFlavor

getRepresentationClass

public Class getRepresentationClass()
Returns the Class which objects supporting this DataFlavor will return when this DataFlavor is requested.

getHumanPresentableName

public String getHumanPresentableName()
Returns the human presentable name for the data foramt that this DataFlavor represents. This name would be localized for different countries

getPrimaryType

public String getPrimaryType()
Returns:
the primary MIME type of this DataFlavor

getSubType

public String getSubType()
Returns:
the Sub MIME type of this DataFlavor

getParameter

public String getParameter(String paramName)
Returns:
the value of the name parameter

setHumanPresentableName

public void setHumanPresentableName(String humanPresentableName)
Sets the human presentable name for the data format that this DataFlavor represents. This name would be localized for different countries

equals

public boolean equals(Object o)
Returns:
if the objects are equal
Overrides:
equals in class Object

equals

public boolean equals(MimeType mt)
Returns:
if the objects are equal

equals

public boolean equals(DataFlavor dataFlavor)
Returns:
if the DataFlavors represent the same type.

equals

public boolean equals(String s)
Returns:
if the String (MimeType) is equal

isMimeTypeEqual

public boolean isMimeTypeEqual(String mimeType)
Is the string representation of the MIME type passed in equivalent to the MIME type of this DataFlavor. This may involve adding default attributes for some MIME types (like adding charset=US-ASCII to text/plain MIME types that have no charset parameter specified)

isMimeTypeEqual

public final boolean isMimeTypeEqual(DataFlavor dataFlavor)
Returns:
if the MimeTypes are equal

isMimeTypeEqual

public boolean isMimeTypeEqual(MimeType mtype)
Returns:
if the MimeTypes are equal

isMimeTypeSerializedObject

public boolean isMimeTypeSerializedObject()
does the DataFlavor represent a serialized object?

isRepresentationClassInputStream

public boolean isRepresentationClassInputStream()
does the DataFlavor represent a serialized object?

isRepresentationClassSerializable

public boolean isRepresentationClassSerializable()
Returns:
true if the representation class can be serialized

writeObject

public void writeObject(ObjectOutputStream oos) throws IOException
Serialize this DataFlavor

readObject

public void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException
restore this DataFlavor from an Serialized state

clone

public Object clone() throws CloneNotSupportedException
Returns:
a clone of this DataFlavor
Overrides:
clone in class Object

normalizeMimeTypeParameter

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. (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


normalizeMimeType

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. 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

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.