src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
equal
deleted
inserted
replaced
52 private final String dbgTag; |
52 private final String dbgTag; |
53 |
53 |
54 ResponseContent(HttpConnection connection, |
54 ResponseContent(HttpConnection connection, |
55 int contentLength, |
55 int contentLength, |
56 HttpHeaders h, |
56 HttpHeaders h, |
57 HttpResponse.BodySubscriber<?> userProcessor, |
57 HttpResponse.BodySubscriber<?> userSubscriber, |
58 Runnable onFinished) |
58 Runnable onFinished) |
59 { |
59 { |
60 this.pusher = userProcessor; |
60 this.pusher = userSubscriber; |
61 this.contentLength = contentLength; |
61 this.contentLength = contentLength; |
62 this.headers = h; |
62 this.headers = h; |
63 this.onFinished = onFinished; |
63 this.onFinished = onFinished; |
64 this.dbgTag = connection.dbgString() + "/ResponseContent"; |
64 this.dbgTag = connection.dbgString() + "/ResponseContent"; |
65 } |
65 } |
95 interface BodyParser extends Consumer<ByteBuffer> { |
95 interface BodyParser extends Consumer<ByteBuffer> { |
96 void onSubscribe(AbstractSubscription sub); |
96 void onSubscribe(AbstractSubscription sub); |
97 } |
97 } |
98 |
98 |
99 // Returns a parser that will take care of parsing the received byte |
99 // Returns a parser that will take care of parsing the received byte |
100 // buffers and forward them to the BodyProcessor. |
100 // buffers and forward them to the BodySubscriber. |
101 // When the parser is done, it will call onComplete. |
101 // When the parser is done, it will call onComplete. |
102 // If parsing was successful, the throwable parameter will be null. |
102 // If parsing was successful, the throwable parameter will be null. |
103 // Otherwise it will be the exception that occurred |
103 // Otherwise it will be the exception that occurred |
104 // Note: revisit: it might be better to use a CompletableFuture than |
104 // Note: revisit: it might be better to use a CompletableFuture than |
105 // a completion handler. |
105 // a completion handler. |