src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/HttpResponse.java
branchhttp-client-branch
changeset 55839 d4142ab48c8a
parent 55837 0262f29eef0d
child 55852 32f6aefec11e
equal deleted inserted replaced
55838:12a64276cc96 55839:d4142ab48c8a
   316         /**
   316         /**
   317          * Returns a response body handler which discards the response body and
   317          * Returns a response body handler which discards the response body and
   318          * uses the given value as a replacement for it.
   318          * uses the given value as a replacement for it.
   319          *
   319          *
   320          * @param <U> the response body type
   320          * @param <U> the response body type
   321          * @param value the value of U to return as the body, may be null
   321          * @param value the value of U to return as the body, may be {@code null}
   322          * @return a response body handler
   322          * @return a response body handler
   323          */
   323          */
   324         public static <U> BodyHandler<U> discard(U value) {
   324         public static <U> BodyHandler<U> discard(U value) {
   325             return (status, headers) -> BodySubscriber.discard(value);
   325             return (status, headers) -> BodySubscriber.discard(value);
   326         }
   326         }
   703          * Returns a response subscriber which discards the response body. The
   703          * Returns a response subscriber which discards the response body. The
   704          * supplied value is the value that will be returned from
   704          * supplied value is the value that will be returned from
   705          * {@link HttpResponse#body()}.
   705          * {@link HttpResponse#body()}.
   706          *
   706          *
   707          * @param <U> The type of the response body
   707          * @param <U> The type of the response body
   708          * @param value the value to return from HttpResponse.body(), may be null
   708          * @param value the value to return from HttpResponse.body(), may be {@code null}
   709          * @return a {@code BodySubscriber}
   709          * @return a {@code BodySubscriber}
   710          */
   710          */
   711         public static <U> BodySubscriber<U> discard(U value) {
   711         public static <U> BodySubscriber<U> discard(U value) {
   712             return new ResponseSubscribers.NullSubscriber<>(Optional.ofNullable(value));
   712             return new ResponseSubscribers.NullSubscriber<>(Optional.ofNullable(value));
   713         }
   713         }