public final class ConfigHelper extends Object
| Modifier and Type | Method and Description |
|---|---|
static Reader |
createReader(Readable readable)
|
static String |
detectContentType(Path path)
Infers the content type contained in the provided
Path. |
static <T> Flow.Subscriber<T> |
subscriber(Function<T,Boolean> onNextFunction)
Creates a
Flow.Subscriber that
will delegate Flow.Subscriber#onNext(Object) to the specified
onNextFunction function. |
static <T> Flow.Publisher<T> |
suspendablePublisher(Flow.Publisher<T> delegatePublisher,
Runnable onFirstSubscriptionRequest,
Runnable onLastSubscriptionCancel)
Creates a
Flow.Publisher which wraps the provided one and also
supports "active" and "suspended" states. |
public static Reader createReader(Readable readable) throws IOException
Reader from the given Readable object.
Equivalent to createReader(readable, 1024). See
createReader(Readable,int).
readable - a readableIOException - when Readable.read(CharBuffer) encounters an errorpublic static <T> Flow.Subscriber<T> subscriber(Function<T,Boolean> onNextFunction)
Flow.Subscriber that
will delegate Flow.Subscriber#onNext(Object) to the specified
onNextFunction function.
The new subscriber's
Flow.Subscriber#onSubscribe(Flow.Subscription) method
automatically invokes Flow.Subscription#request(long) to request
all events that are available in the subscription.
The caller-provided onNextFunction should return false in
order to cancel current subscription.
T - the type of the items provided by the subscriptiononNextFunction - function to be invoked during onNext
processingSubscriber that delegates its onNext to the
caller-provided functionpublic static <T> Flow.Publisher<T> suspendablePublisher(Flow.Publisher<T> delegatePublisher, Runnable onFirstSubscriptionRequest, Runnable onLastSubscriptionCancel)
Flow.Publisher which wraps the provided one and also
supports "active" and "suspended" states.
The new Publisher starts in the "suspended" state.
Upon the first subscriber request the Publisher transitions into the "active" state
and invokes the caller-supplied onFirstSubscriptionRequest Runnable.
When the last subscriber cancels the returned Publisher transitions into the "suspended" state and
invokes the caller-provided onLastSubscriptionCancel Runnable.
T - the type of the items provided by the publisherdelegatePublisher - publisher to be wrappedonFirstSubscriptionRequest - hook invoked when the first subscriber requests events from the publisheronLastSubscriptionCancel - hook invoked when last remaining subscriber cancels its subscriptionFlow.PublisherCopyright © 2018, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.