Package limn.transfer
Interface Offer
public interface Offer
What is there to take: the contents of the clipboard at one moment, or what a drag is carrying.
It lists its formats at once and hands over a value only when asked, since the value may have
to come from another program.
UI thread only. A stage returned by read(limn.transfer.DataFormat<T>) completes on the UI thread.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionSet<DataFormat<?>> formats()The formats on offer: the standard ones, and those the application has declared withDataFormat.of(java.lang.String, java.util.function.Function<T, byte[]>, java.util.function.Function<byte[], T>)or put there itself.default booleanhas(DataFormat<?> format) <T> CompletionStage<T> read(DataFormat<T> format) Asks for the value in one format.
-
Field Details
-
EMPTY
An offer of nothing.
-
-
Method Details
-
formats
Set<DataFormat<?>> formats()The formats on offer: the standard ones, and those the application has declared withDataFormat.of(java.lang.String, java.util.function.Function<T, byte[]>, java.util.function.Function<byte[], T>)or put there itself. What another program offers under a name the application never declared is not listed.- Returns:
- the formats, in the order the source prefers them; empty when nothing is offered
-
has
- Parameters:
format- a format- Returns:
- whether it is on offer
-
read
Asks for the value in one format.- Type Parameters:
T- the type of its value- Parameters:
format- the format, one offormats()- Returns:
- the value; completed exceptionally with
TransferGoneExceptionwhen it is not, or no longer, on offer
-