--- old/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java 2017-08-03 17:42:12.000000000 +0100 +++ new/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java 2017-08-03 17:42:12.000000000 +0100 @@ -27,6 +27,7 @@ import java.io.IOException; import java.nio.ByteBuffer; +import java.util.List; import java.util.Optional; import java.util.function.Consumer; import jdk.incubator.http.internal.common.Utils; @@ -45,7 +46,7 @@ ByteBuffer buffer; //ByteBuffer lastBufferUsed; final ResponseHeaders headers; - private final Consumer> dataConsumer; + private final Consumer>> dataConsumer; private final Consumer errorConsumer; private final HttpClientImpl client; // this needs to run before we complete the body @@ -56,7 +57,7 @@ int contentLength, ResponseHeaders h, HttpResponse.BodyProcessor userProcessor, - Consumer> dataConsumer, + Consumer>> dataConsumer, Consumer errorConsumer, Runnable onFinished) { @@ -227,7 +228,7 @@ ByteBuffer b1 = readChunkedBuffer(); if (b1 != null) { if (b1.hasRemaining()) { - dataConsumer.accept(Optional.of(b1)); + dataConsumer.accept(Optional.of(List.of(b1))); } } else { onFinished.run(); @@ -258,7 +259,7 @@ Utils.copy(b, buffer, amount); remaining -= amount; buffer.flip(); - dataConsumer.accept(Optional.of(buffer)); + dataConsumer.accept(Optional.of(List.of(buffer))); } while (remaining > 0) { ByteBuffer buffer = connection.read(); @@ -271,7 +272,7 @@ throw new IOException("too many bytes read"); } remaining -= bytesread; - dataConsumer.accept(Optional.of(buffer)); + dataConsumer.accept(Optional.of(List.of(buffer))); } onFinished.run(); dataConsumer.accept(Optional.empty());