インタフェースjava.net.http.HttpResponse.BodyHandlerの
使用
-
java.net.httpでのHttpResponse.BodyHandlerの使用
修飾子と型メソッド説明static <T> HttpResponse.BodyHandler<T>
HttpResponse.BodyHandlers.buffering
(HttpResponse.BodyHandler<T> downstreamHandler, int bufferSize) BodyHandler
を返します。BodyHandler
は、呼び出されるとデータをバッファリングして下流のサブスクライバに配信する「BodySubscriberをバッファリング」を返します。static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.discarding()
レスポンス本文を破棄するレスポンス本文ハンドラを返します。static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.fromLineSubscriber
(Flow.Subscriber<? super String> subscriber) 指定されたBodySubscribers.fromLineSubscriber(subscriber, s -> null, charset, null)
から取得されたBodySubscriber
<Void>
を返すレスポンス本文ハンドラを返します。static <S extends Flow.Subscriber<? super String>,
T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers.fromLineSubscriber
(S subscriber, Function<? super S, ? extends T> finisher, String lineSeparator) BodySubscribers.fromLineSubscriber(subscriber, finisher, charset, lineSeparator)
から取得したBodySubscriber
<T>
を返し、指定されたsubscriber
、finisher
関数および行セパレータを含むレスポンス本文ハンドラを返します。static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.fromSubscriber
(Flow.Subscriber<? super List<ByteBuffer>> subscriber) 指定されたHttpResponse.BodySubscribers.fromSubscriber(Subscriber)
から取得されたBodySubscriber
<Void>
を返すレスポンス本文ハンドラを返します。static <S extends Flow.Subscriber<? super List<ByteBuffer>>,
T>
HttpResponse.BodyHandler<T>HttpResponse.BodyHandlers.fromSubscriber
(S subscriber, Function<? super S, ? extends T> finisher) 指定されたsubscriber
およびfinisher
関数を使用して、HttpResponse.BodySubscribers.fromSubscriber(Subscriber, Function)
から取得されたBodySubscriber
<T>
を返すレスポンス本文ハンドラを返します。static HttpResponse.BodyHandler<byte[]>
HttpResponse.BodyHandlers.ofByteArray()
BodySubscribers.ofByteArray()
から取得したBodySubscriber
<byte[]>
を返すBodyHandler<byte[]>
を返します。static HttpResponse.BodyHandler<Void>
HttpResponse.BodyHandlers.ofByteArrayConsumer
(Consumer<Optional<byte[]>> consumer) BodySubscribers.ofByteArrayConsumer(Consumer)
から取得されたBodySubscriber
<Void>
を返すBodyHandler<Void>
を返します。static HttpResponse.BodyHandler<Path>
BodySubscriber
<Path>
を返すBodyHandler<Path>
を返します。static HttpResponse.BodyHandler<Path>
HttpResponse.BodyHandlers.ofFile
(Path file, OpenOption... openOptions) BodySubscribers.ofFile(Path,OpenOption...)
から取得されたBodySubscriber
<Path>
を返すBodyHandler<Path>
を返します。static HttpResponse.BodyHandler<Path>
HttpResponse.BodyHandlers.ofFileDownload
(Path directory, OpenOption... openOptions) ダウンロード・ディレクトリが指定されているBodySubscriber
<Path
>を返すBodyHandler<Path>
を返しますが、ファイル名はContent-Disposition
レスポンス・ヘッダーから取得されます。static HttpResponse.BodyHandler<InputStream>
HttpResponse.BodyHandlers.ofInputStream()
BodySubscribers.ofInputStream
から取得されたBodySubscriber
<InputStream>
を返すBodyHandler<InputStream>
を返します。static HttpResponse.BodyHandler<Stream<String>>
HttpResponse.BodyHandlers.ofLines()
BodySubscribers.ofLines(charset)
から取得されたBodySubscriber
<Stream<String>>
を返すBodyHandler<Stream<String>>
を返します。static HttpResponse.BodyHandler<Flow.Publisher<List<ByteBuffer>>>
HttpResponse.BodyHandlers.ofPublisher()
BodySubscribers.ofPublisher()
から取得したBodySubscriber
<Publisher<List<ByteBuffer>>>
を作成するBodyHandler<Publisher<List<ByteBuffer>>>
を返します。static HttpResponse.BodyHandler<String>
HttpResponse.BodyHandlers.ofString()
BodySubscribers.ofString(Charset)
から取得されたBodySubscriber
<String>
を返すBodyHandler<String>
を返します。static HttpResponse.BodyHandler<String>
BodySubscribers.ofString(Charset)
から取得されたBodySubscriber
<String>
を返すBodyHandler<String>
を返します。static <U> HttpResponse.BodyHandler<U>
HttpResponse.BodyHandlers.replacing
(U value) レスポンス本文を破棄した後、指定された置換値を返すレスポンス本文ハンドラを返します。修飾子と型メソッド説明static <T> HttpResponse.BodyHandler<T>
HttpResponse.BodyHandlers.buffering
(HttpResponse.BodyHandler<T> downstreamHandler, int bufferSize) BodyHandler
を返します。BodyHandler
は、呼び出されるとデータをバッファリングして下流のサブスクライバに配信する「BodySubscriberをバッファリング」を返します。abstract <T> HttpResponse<T>
HttpClient.send
(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler) このクライアントを使用してリクエストを送信し、必要に応じてブロックしてレスポンスを取得します。abstract <T> CompletableFuture<HttpResponse<T>>
HttpClient.sendAsync
(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler) 指定されたレスポンス本文ハンドラとともに、このクライアントを使用して、指定されたリクエストを非同期に送信します。abstract <T> CompletableFuture<HttpResponse<T>>
HttpClient.sendAsync
(HttpRequest request, HttpResponse.BodyHandler<T> responseBodyHandler, HttpResponse.PushPromiseHandler<T> pushPromiseHandler) 指定されたレスポンス本文ハンドラとともにこのクライアントを使用して、指定されたリクエストを非同期に送信し、プッシュ・プロミス・ハンドラをプッシュします。修飾子と型メソッド説明void
HttpResponse.PushPromiseHandler.applyPushPromise
(HttpRequest initiatingRequest, HttpRequest pushPromiseRequest, Function<HttpResponse.BodyHandler<T>, CompletableFuture<HttpResponse<T>>> acceptor) 受信プッシュ・プロミスの通知。static <T> HttpResponse.PushPromiseHandler<T>
HttpResponse.PushPromiseHandler.of
(Function<HttpRequest, HttpResponse.BodyHandler<T>> pushPromiseHandler, ConcurrentMap<HttpRequest, CompletableFuture<HttpResponse<T>>> pushPromisesMap) 指定されたマップに、プッシュ・プロミスおよびそのレスポンスを累積する、プッシュ・プロミス・ハンドラを返します。