Uses of Interface
java.net.http.HttpResponse.BodyHandler
-
Packages that use HttpResponse.BodyHandler Package Description java.net.http HTTP Client and WebSocket APIs -
-
Uses of HttpResponse.BodyHandler in java.net.http
Methods in java.net.http that return HttpResponse.BodyHandler Modifier and Type Method Description static <T> HttpResponse.BodyHandler<T>
HttpResponse.BodyHandlers. buffering(HttpResponse.BodyHandler<T> downstreamHandler, int bufferSize)
Returns aBodyHandler
which, when invoked, returns a buffering BodySubscriber that buffers data before delivering it to the downstream subscriber.static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers. discarding()
Returns a response body handler that discards the response body.static 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 <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 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 <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 HttpResponse.BodyHandler<byte[]>
HttpResponse.BodyHandlers. ofByteArray()
Returns aBodyHandler<byte[]>
that returns aBodySubscriber
<byte[]
> obtained fromBodySubscribers.ofByteArray()
.static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers. ofByteArrayConsumer(Consumer<Optional<byte[]>> consumer)
Returns aBodyHandler<Void>
that returns aBodySubscriber
<Void>
obtained fromBodySubscribers.ofByteArrayConsumer(Consumer)
.static HttpResponse.BodyHandler<Path>
HttpResponse.BodyHandlers. ofFile(Path file)
static HttpResponse.BodyHandler<Path>
HttpResponse.BodyHandlers. ofFile(Path file, OpenOption... openOptions)
Returns aBodyHandler<Path>
that returns aBodySubscriber
<Path>
obtained fromBodySubscribers.ofFile(Path,OpenOption...)
.static HttpResponse.BodyHandler<Path>
HttpResponse.BodyHandlers. ofFileDownload(Path directory, OpenOption... openOptions)
Returns aBodyHandler<Path>
that returns aBodySubscriber
<Path
> where the download directory is specified, but the filename is obtained from theContent-Disposition
response header.static HttpResponse.BodyHandler<InputStream>
HttpResponse.BodyHandlers. ofInputStream()
Returns aBodyHandler<InputStream>
that returns aBodySubscriber
<InputStream>
obtained fromBodySubscribers.ofInputStream
.static HttpResponse.BodyHandler<Stream<String>>
HttpResponse.BodyHandlers. ofLines()
Returns aBodyHandler<Stream<String>>
that returns aBodySubscriber
<Stream<String>>
obtained fromBodySubscribers.ofLines(charset)
.static HttpResponse.BodyHandler<Flow.Publisher<List<ByteBuffer>>>
HttpResponse.BodyHandlers. ofPublisher()
Returns aBodyHandler<Publisher<List<ByteBuffer>>>
that creates aBodySubscriber
<Publisher<List<ByteBuffer>>>
obtained fromBodySubscribers.ofPublisher()
.static HttpResponse.BodyHandler<String>
HttpResponse.BodyHandlers. ofString()
Returns aBodyHandler<String>
that returns aBodySubscriber
<String>
obtained fromBodySubscribers.ofString(Charset)
.static HttpResponse.BodyHandler<String>
HttpResponse.BodyHandlers. ofString(Charset charset)
Returns aBodyHandler<String>
that returns aBodySubscriber
<String>
obtained fromBodySubscribers.ofString(Charset)
.static <U> HttpResponse.BodyHandler<U>
HttpResponse.BodyHandlers. replacing(U value)
Returns a response body handler that returns the given replacement value, after discarding the response body.Methods in java.net.http with parameters of type HttpResponse.BodyHandler Modifier and Type Method Description static <T> HttpResponse.BodyHandler<T>
HttpResponse.BodyHandlers. buffering(HttpResponse.BodyHandler<T> downstreamHandler, int bufferSize)
Returns aBodyHandler
which, when invoked, returns a buffering BodySubscriber that buffers data before delivering it to the downstream subscriber.abstract <T> HttpResponse<T>
HttpClient. send(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler)
Sends the given request using this client, blocking if necessary to get the response.abstract <T> CompletableFuture<HttpResponse<T>>
HttpClient. sendAsync(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler)
Sends the given request asynchronously using this client with the given response body handler.abstract <T> CompletableFuture<HttpResponse<T>>
HttpClient. sendAsync(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler, HttpResponse.PushPromiseHandler<T> pushPromiseHandler)
Sends the given request asynchronously using this client with the given response body handler and push promise handler.Method parameters in java.net.http with type arguments of type HttpResponse.BodyHandler Modifier and Type Method Description void
HttpResponse.PushPromiseHandler. applyPushPromise(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function<HttpResponse.BodyHandler<T>,CompletableFuture<HttpResponse<T>>> acceptor)
Notification of an incoming push promise.static <T> HttpResponse.PushPromiseHandler<T>
HttpResponse.PushPromiseHandler. of(Function<HttpRequest,HttpResponse.BodyHandler<T>> pushPromiseHandler, ConcurrentMap<HttpRequest,CompletableFuture<HttpResponse<T>>> pushPromisesMap)
Returns a push promise handler that accumulates push promises, and their responses, into the given map.
-