APIdia Launch Partner
Top Description Methods
sun.datatransfer

public Interface DesktopDatatransferService

Known Direct Implementers
sun.datatransfer.DataFlavorUtil.DefaultDesktopDatatransferService
Imports
java.awt.datatransfer.DataFlavor, .FlavorMap, java.util.LinkedHashSet, java.util.function.Supplier

Contains services which desktop provides to the datatransfer system to enrich it's functionality.
Author
Petr Pchelko
Since
9

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

default unicode encoding
getDefaultUnicodeEncoding
()

Get a platform-dependent default unicode encoding to use in datatransfer system.

public FlavorMap

Returns:

a FlavorMap
getFlavorMap
(Supplier<FlavorMap>
a constructor that should be used to create a new instance of the FlavorMap
supplier
)

Takes an appropriate FlavorMap from the desktop.

public LinkedHashSet<String>

Returns:

set of platform-specific mappings for a DataFlavor
getPlatformMappingsForFlavor
(DataFlavor
DataFlavor to return mappings for
df
)

Returns platform-specific mappings for the specified flavor.

public LinkedHashSet<DataFlavor>

Returns:

set of platform-specific mappings for a native format
getPlatformMappingsForNative
(String
a native format to return flavors for
nat
)

Returns platform-specific mappings for the specified native format.

public void
invokeOnEventThread(Runnable
a Runnable to invoke
r
)

If desktop is present - invokes a Runnable on the event dispatch thread.

public boolean

Returns:

true is the desktop is present
isDesktopPresent
()

Checks if desktop is present.

public void
registerTextFlavorProperties(String nat, String charset, String eoln, String terminators)

This method is called for text flavor mappings established while parsing the default flavor mappings file.

Method Detail

getDefaultUnicodeEncodingback to summary
public String getDefaultUnicodeEncoding()

Get a platform-dependent default unicode encoding to use in datatransfer system.

Returns:String

default unicode encoding

getFlavorMapback to summary
public FlavorMap getFlavorMap(Supplier<FlavorMap> supplier)

Takes an appropriate FlavorMap from the desktop. If no appropriate table is found - uses a provided supplier to instantiate a table. If the desktop is absent - creates and returns a system singleton.

Parameters
supplier:Supplier<FlavorMap>

a constructor that should be used to create a new instance of the FlavorMap

Returns:FlavorMap

a FlavorMap

getPlatformMappingsForFlavorback to summary
public LinkedHashSet<String> getPlatformMappingsForFlavor(DataFlavor df)

Returns platform-specific mappings for the specified flavor. If there are no platform-specific mappings for this flavor, the method returns an empty Set.

Parameters
df:DataFlavor

DataFlavor to return mappings for

Returns:LinkedHashSet<String>

set of platform-specific mappings for a DataFlavor

getPlatformMappingsForNativeback to summary
public LinkedHashSet<DataFlavor> getPlatformMappingsForNative(String nat)

Returns platform-specific mappings for the specified native format. If there are no platform-specific mappings for this native, the method returns an empty Set.

Parameters
nat:String

a native format to return flavors for

Returns:LinkedHashSet<DataFlavor>

set of platform-specific mappings for a native format

invokeOnEventThreadback to summary
public void invokeOnEventThread(Runnable r)

If desktop is present - invokes a Runnable on the event dispatch thread. Otherwise invokes a run() method directly.

Parameters
r:Runnable

a Runnable to invoke

isDesktopPresentback to summary
public boolean isDesktopPresent()

Checks if desktop is present.

Returns:boolean

true is the desktop is present

registerTextFlavorPropertiesback to summary
public void registerTextFlavorProperties(String nat, String charset, String eoln, String terminators)

This method is called for text flavor mappings established while parsing the default flavor mappings file. It stores the "eoln" and "terminators" parameters which are not officially part of the MIME type. They are MIME parameters specific to the flavormap.properties file format.