Uses of Interface
java.net.http.HttpResponse.BodySubscriber
Packages that use HttpResponse.BodySubscriber
-
Uses of HttpResponse.BodySubscriber in java.net.http
Methods in java.net.http that return HttpResponse.BodySubscriberModifier and TypeMethodDescriptionHttpResponse.BodyHandler.apply
(HttpResponse.ResponseInfo responseInfo) Returns aBodySubscriber
considering the given response status code and headers.static <T> HttpResponse.BodySubscriber<T>
HttpResponse.BodySubscribers.buffering
(HttpResponse.BodySubscriber<T> downstream, int bufferSize) Returns aBodySubscriber
which buffers data before delivering it to the given downstream subscriber.static HttpResponse.BodySubscriber<Void>
HttpResponse.BodySubscribers.discarding()
Returns a response subscriber which discards the response body.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 <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 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
.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
.static <T,
U> HttpResponse.BodySubscriber<U> HttpResponse.BodySubscribers.mapping
(HttpResponse.BodySubscriber<T> upstream, Function<? super T, ? extends U> mapper) Returns aBodySubscriber
whose response body value is that of the result of applying the given function to the body object of the givenupstream
BodySubscriber
.static HttpResponse.BodySubscriber<byte[]>
HttpResponse.BodySubscribers.ofByteArray()
Returns aBodySubscriber
which stores the response body as a byte array.static HttpResponse.BodySubscriber<Void>
HttpResponse.BodySubscribers.ofByteArrayConsumer
(Consumer<Optional<byte[]>> consumer) Returns aBodySubscriber
which provides the incoming body data to the provided Consumer ofOptional<byte[]>
.static HttpResponse.BodySubscriber<Path>
Returns aBodySubscriber
which stores the response body in a file opened with the given name.static HttpResponse.BodySubscriber<Path>
HttpResponse.BodySubscribers.ofFile
(Path file, OpenOption... openOptions) Returns aBodySubscriber
which stores the response body in a file opened with the given options and name.HttpResponse.BodySubscribers.ofInputStream()
Returns aBodySubscriber
which streams the response body as anInputStream
.static HttpResponse.BodySubscriber<Stream<String>>
Returns aBodySubscriber
which streams the response body as aStream
<String>
, where each string in the stream corresponds to a line as defined byBufferedReader.lines()
.HttpResponse.BodySubscribers.ofPublisher()
Returns a response subscriber which publishes the response body through aPublisher<List<ByteBuffer>>
.static HttpResponse.BodySubscriber<String>
Returns a body subscriber which stores the response body as aString
converted using the givenCharset
.static <U> HttpResponse.BodySubscriber<U>
HttpResponse.BodySubscribers.replacing
(U value) Returns a response subscriber which discards the response body.Methods in java.net.http with parameters of type HttpResponse.BodySubscriberModifier and TypeMethodDescriptionstatic <T> HttpResponse.BodySubscriber<T>
HttpResponse.BodySubscribers.buffering
(HttpResponse.BodySubscriber<T> downstream, int bufferSize) Returns aBodySubscriber
which buffers data before delivering it to the given downstream subscriber.static <T,
U> HttpResponse.BodySubscriber<U> HttpResponse.BodySubscribers.mapping
(HttpResponse.BodySubscriber<T> upstream, Function<? super T, ? extends U> mapper) Returns aBodySubscriber
whose response body value is that of the result of applying the given function to the body object of the givenupstream
BodySubscriber
.