is new.
java.lang.Objectjava.awt.datatransfer.SystemFlavorMap
The SystemFlavorMap is a configurable map between "natives" (Strings), which correspond to platform-specific data formats, and "flavors" (DataFlavors), which correspond to platform-independent MIME types. This mapping is used by the data transfer subsystem to transfer data between Java and native applications, and between Java applications in separate VMs.
In the Sun reference implementation, the default SystemFlavorMap is initialized by the file jre/lib/flavormap.properties and the contents of the URL referenced by the AWT property AWT.DnD.flavorMapFileURL. See flavormap.properties for details.
| Method Summary | |
|---|---|
| void |
addFlavorForUnencodedNative
(
String
nat,
DataFlavor
flav) Adds a mapping from a single String native to a single DataFlavor. |
| void |
addUnencodedNativeForFlavor
(
DataFlavor
flav,
String
nat) Adds a mapping from the specified DataFlavor (and all DataFlavors equal to the specified DataFlavor) to the specified String native. |
| static DataFlavor |
decodeDataFlavor
(
String
nat) Decodes a String native for use as a DataFlavor. |
| static String |
decodeJavaMIMEType
(
String
nat) Decodes a String native for use as a Java MIME type. |
| static String |
encodeDataFlavor
(
DataFlavor
flav) Encodes a DataFlavor for use as a String native. |
| static String |
encodeJavaMIMEType
(
String
mimeType) Encodes a MIME type for use as a String native. |
| static FlavorMap |
getDefaultFlavorMap
() Returns the default FlavorMap for this thread's ClassLoader. |
| List |
getFlavorsForNative
(
String
nat) Returns a List of DataFlavors to which the specified String native can be translated by the data transfer subsystem. |
| Map |
getFlavorsForNatives
(
String
[] natives) Returns a Map of the specified String natives to their most preferred DataFlavor. |
| List |
getNativesForFlavor
(
DataFlavor
flav) Returns a List of String natives to which the specified DataFlavor can be translated by the data transfer subsystem. |
| Map |
getNativesForFlavors
(
DataFlavor
[] flavors) Returns a Map of the specified DataFlavors to their most preferred String native. |
| static boolean |
isJavaMIMEType
(
String
str) Returns whether the specified String is an encoded Java MIME type. |
| void |
setFlavorsForNative
(
String
nat,
DataFlavor
[] flavors) Discards the current mappings for the specified String native, and creates new mappings to the specified DataFlavors. |
| void |
setNativesForFlavor
(
DataFlavor
flav,
String
[] natives) Discards the current mappings for the specified DataFlavor and all DataFlavors equal to the specified DataFlavor, and creates new mappings to the specified String natives. |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Method Detail |
|---|
public static FlavorMap getDefaultFlavorMap()
public List getNativesForFlavor(DataFlavor flav)
If the specified DataFlavor is previously unknown to the data transfer
subsystem and the data transfer subsystem is unable to translate this DataFlavor to any existing native,
subsystem,
then invoking this method will establish a mapping in both directions between the specified DataFlavor and an encoded version of its MIME type as its native.
public List getFlavorsForNative(String nat)
If the specified native is previously unknown to the data transfer subsystem, and that native has been properly encoded, then invoking this method will establish a mapping in both directions between the specified native and a DataFlavor whose MIME type is a decoded version of the native.
If the specified native is not a properly encoded native and the mappings for this native have not been altered with setFlavorsForNative, then the contents of the List is platform dependent, but null cannot be returned.
public Map getNativesForFlavors(DataFlavor[] flavors)
If a specified DataFlavor is previously unknown to the data transfer subsystem, then invoking this method will establish a mapping in both directions between the specified DataFlavor and an encoded version of its MIME type as its native.
public Map getFlavorsForNatives(String[] natives)
If a specified native is previously unknown to the data transfer subsystem, and that native has been properly encoded, then invoking this method will establish a mapping in both directions between the specified native and a DataFlavor whose MIME type is a decoded version of the native.
public void addUnencodedNativeForFlavor(DataFlavor flav,
String nat)
public void setNativesForFlavor(DataFlavor flav,
String[] natives)
If the array contains several elements that reference equal String natives, this method will establish new mappings for the first of those elements and ignore the rest of them.
It is recommended that client code not reset mappings established by the data transfer subsystem. This method should only be used for application-level mappings.
public void addFlavorForUnencodedNative(String nat,
DataFlavor flav)
public void setFlavorsForNative(String nat,
DataFlavor[] flavors)
If the array contains several elements that reference equal DataFlavors, this method will establish new mappings for the first of those elements and ignore the rest of them.
It is recommended that client code not reset mappings established by the data transfer subsystem. This method should only be used for application-level mappings.
public static String encodeJavaMIMEType(String mimeType)
Sun's reference implementation of this method returns the specified MIME type String prefixed with JAVA_DATAFLAVOR:.
public static String encodeDataFlavor(DataFlavor flav)
Sun's reference implementation of this method returns the MIME type String of the specified DataFlavor prefixed with JAVA_DATAFLAVOR:.
public static boolean isJavaMIMEType(String str)
public static String decodeJavaMIMEType(String nat)
public static DataFlavor decodeDataFlavor(String nat)
throws ClassNotFoundException