Uses of Interface
java.util.concurrent.Flow.Subscriber
Package
Description
HTTP Client and WebSocket APIs
Utility classes commonly useful in concurrent programming.
-
Uses of Flow.Subscriber in java.net.http
Modifier and TypeInterfaceDescriptionstatic interface
ABodySubscriber
consumes response body bytes and converts them into a higher-level Java type.Modifier and TypeMethodDescriptionstatic <S extends Flow.Subscriber<? super String>,
T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers.fromLineSubscriber
(S subscriber, Function<? super S, ? extends T> finisher, String lineSeparator) Returns a response body handler that returns aBodySubscriber
<T>
obtained fromBodySubscribers.fromLineSubscriber(subscriber, finisher, charset, lineSeparator)
, with the givensubscriber
,finisher
function, and line separator.static <S extends Flow.Subscriber<? super String>,
T>
HttpResponse.BodySubscriber<T>HttpResponse.BodySubscribers.fromLineSubscriber
(S subscriber, Function<? super S, ? extends T> finisher, Charset charset, String lineSeparator) Returns a body subscriber that forwards all response body to the givenFlow.Subscriber
, line by line.static <S extends Flow.Subscriber<? super List<ByteBuffer>>,
T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers.fromSubscriber
(S subscriber, Function<? super S, ? extends T> finisher) Returns a response body handler that returns aBodySubscriber
<T>
obtained fromHttpResponse.BodySubscribers.fromSubscriber(Subscriber, Function)
, with the givensubscriber
andfinisher
function.static <S extends Flow.Subscriber<? super List<ByteBuffer>>,
T>
HttpResponse.BodySubscriber<T>HttpResponse.BodySubscribers.fromSubscriber
(S subscriber, Function<? super S, ? extends T> finisher) Returns a body subscriber that forwards all response body to the givenFlow.Subscriber
.Modifier and TypeMethodDescriptionstatic HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.fromLineSubscriber
(Flow.Subscriber<? super String> subscriber) Returns a response body handler that returns aBodySubscriber
<Void>
obtained fromBodySubscribers.fromLineSubscriber(subscriber, s -> null, charset, null)
, with the givensubscriber
.static HttpResponse.BodySubscriber<Void>
HttpResponse.BodySubscribers.fromLineSubscriber
(Flow.Subscriber<? super String> subscriber) Returns a body subscriber that forwards all response body to the givenFlow.Subscriber
, line by line.static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.fromSubscriber
(Flow.Subscriber<? super List<ByteBuffer>> subscriber) Returns a response body handler that returns aBodySubscriber
<Void>
obtained fromHttpResponse.BodySubscribers.fromSubscriber(Subscriber)
, with the givensubscriber
.static HttpResponse.BodySubscriber<Void>
HttpResponse.BodySubscribers.fromSubscriber
(Flow.Subscriber<? super List<ByteBuffer>> subscriber) Returns a body subscriber that forwards all response body to the givenFlow.Subscriber
. -
Uses of Flow.Subscriber in java.util.concurrent
Modifier and TypeInterfaceDescriptionstatic interface
Flow.Processor<T,
R> A component that acts as both a Subscriber and Publisher.Modifier and TypeMethodDescriptionList<Flow.Subscriber<? super T>>
SubmissionPublisher.getSubscribers()
Returns a list of current subscribers for monitoring and tracking purposes, not for invokingFlow.Subscriber
methods on the subscribers.Modifier and TypeMethodDescriptionboolean
SubmissionPublisher.isSubscribed
(Flow.Subscriber<? super T> subscriber) Returns true if the given Subscriber is currently subscribed.void
Flow.Publisher.subscribe
(Flow.Subscriber<? super T> subscriber) Adds the given Subscriber if possible.void
SubmissionPublisher.subscribe
(Flow.Subscriber<? super T> subscriber) Adds the given Subscriber unless already subscribed.Modifier and TypeMethodDescriptionint
SubmissionPublisher.offer
(T item, long timeout, TimeUnit unit, BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) Publishes the given item, if possible, to each current subscriber by asynchronously invoking itsonNext
method, blocking while resources for any subscription are unavailable, up to the specified timeout or until the caller thread is interrupted, at which point the given handler (if non-null) is invoked, and if it returns true, retried once.int
SubmissionPublisher.offer
(T item, BiPredicate<Flow.Subscriber<? super T>, ? super T> onDrop) Publishes the given item, if possible, to each current subscriber by asynchronously invoking itsonNext
method.ModifierConstructorDescriptionSubmissionPublisher
(Executor executor, int maxBufferCapacity, BiConsumer<? super Flow.Subscriber<? super T>, ? super Throwable> handler) Creates a new SubmissionPublisher using the given Executor for async delivery to subscribers, with the given maximum buffer size for each subscriber, and, if non-null, the given handler invoked when any Subscriber throws an exception in methodonNext
.