src/java.net.http/share/classes/java/net/http/HttpResponse.java
branchhttp-client-branch
changeset 56160 f1b75e394b68
parent 56159 039ab5a71a5c
child 56167 96fa4f49a9ff
equal deleted inserted replaced
56159:039ab5a71a5c 56160:f1b75e394b68
   239          * @param responseHeaders the response headers received
   239          * @param responseHeaders the response headers received
   240          * @return a body subscriber
   240          * @return a body subscriber
   241          */
   241          */
   242         public BodySubscriber<T> apply(int statusCode, HttpHeaders responseHeaders);
   242         public BodySubscriber<T> apply(int statusCode, HttpHeaders responseHeaders);
   243 
   243 
   244 
       
   245         /**
   244         /**
   246          * Returns a response body handler that returns a {@link BodySubscriber
   245          * Returns a response body handler that returns a {@link BodySubscriber
   247          * BodySubscriber}{@code <Void>} obtained from {@link
   246          * BodySubscriber}{@code <Void>} obtained from {@link
   248          * BodySubscriber#fromSubscriber(Subscriber)}, with the given
   247          * BodySubscriber#fromSubscriber(Subscriber)}, with the given
   249          * {@code subscriber}.
   248          * {@code subscriber}.
   298          * @param subscriber the subscriber
   297          * @param subscriber the subscriber
   299          * @param finisher a function to be applied after the subscriber has completed
   298          * @param finisher a function to be applied after the subscriber has completed
   300          * @return a response body handler
   299          * @return a response body handler
   301          */
   300          */
   302         public static <S extends Subscriber<? super List<ByteBuffer>>,T> BodyHandler<T>
   301         public static <S extends Subscriber<? super List<ByteBuffer>>,T> BodyHandler<T>
   303         fromSubscriber(S subscriber, Function<S,? extends T> finisher) {
   302         fromSubscriber(S subscriber, Function<? super S,? extends T> finisher) {
   304             Objects.requireNonNull(subscriber);
   303             Objects.requireNonNull(subscriber);
   305             Objects.requireNonNull(finisher);
   304             Objects.requireNonNull(finisher);
   306             return (status, headers) -> BodySubscriber.fromSubscriber(subscriber,
   305             return (status, headers) -> BodySubscriber.fromSubscriber(subscriber,
   307                                                                       finisher);
   306                                                                       finisher);
   308         }
   307         }