public final class ConfigHelper
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
static java.io.Reader |
createReader(java.lang.Readable readable) |
Creates a
Reader from the given Readable object. |
static java.lang.String |
detectContentType(java.nio.file.Path path) |
Infers the content type contained in the provided
Path . |
static <T> io.helidon.common.reactive.Flow.Subscriber<T> |
subscriber(java.util.function.Function<T,java.lang.Boolean> onNextFunction) |
Creates a
Flow.Subscriber that
will delegate Flow.Subscriber.onNext(Object) to the specified
onNextFunction function. |
static <T> io.helidon.common.reactive.Flow.Publisher<T> |
suspendablePublisher(io.helidon.common.reactive.Flow.Publisher<T> delegatePublisher,
java.lang.Runnable onFirstSubscriptionRequest,
java.lang.Runnable onLastSubscriptionCancel) |
Creates a
Flow.Publisher which wraps the provided one and also
supports "active" and "suspended" states. |
public static java.io.Reader createReader(java.lang.Readable readable) throws java.io.IOException
Reader
from the given Readable
object.
Equivalent to createReader(readable, 1024)
. See
createReader(Readable,int)
.
readable
- a readablejava.io.IOException
- when Readable.read(CharBuffer)
encounters an errorpublic static <T> io.helidon.common.reactive.Flow.Subscriber<T> subscriber(java.util.function.Function<T,java.lang.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> io.helidon.common.reactive.Flow.Publisher<T> suspendablePublisher(io.helidon.common.reactive.Flow.Publisher<T> delegatePublisher, java.lang.Runnable onFirstSubscriptionRequest, java.lang.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.Publisher
public static java.lang.String detectContentType(java.nio.file.Path path)
Path
.path
- path to checkCopyright © 2018 Oracle Corporation. All rights reserved.