< prev index next >
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/ResponseContent.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 305,315 ****
debug.log(Level.DEBUG, "Reading chunk: available %d, needed %d",
bytesread, unfulfilled);
int bytes2return = Math.min(bytesread, unfulfilled);
debug.log(Level.DEBUG, "Returning chunk bytes: %d", bytes2return);
! returnBuffer = Utils.slice(chunk, bytes2return);
unfulfilled = bytesremaining -= bytes2return;
if (unfulfilled == 0) bytesToConsume = 2;
}
assert unfulfilled >= 0;
--- 305,315 ----
debug.log(Level.DEBUG, "Reading chunk: available %d, needed %d",
bytesread, unfulfilled);
int bytes2return = Math.min(bytesread, unfulfilled);
debug.log(Level.DEBUG, "Returning chunk bytes: %d", bytes2return);
! returnBuffer = Utils.sliceWithLimitedCapacity(chunk, bytes2return);
unfulfilled = bytesremaining -= bytes2return;
if (unfulfilled == 0) bytesToConsume = 2;
}
assert unfulfilled >= 0;
*** 437,447 ****
// demand.
boolean hasDemand = sub.demand().tryDecrement();
assert hasDemand;
int amount = Math.min(b.remaining(), unfulfilled);
unfulfilled = remaining -= amount;
! ByteBuffer buffer = Utils.slice(b, amount);
pusher.onNext(List.of(buffer));
}
if (unfulfilled == 0) {
// We're done! All data has been received.
assert closedExceptionally == null;
--- 437,447 ----
// demand.
boolean hasDemand = sub.demand().tryDecrement();
assert hasDemand;
int amount = Math.min(b.remaining(), unfulfilled);
unfulfilled = remaining -= amount;
! ByteBuffer buffer = Utils.sliceWithLimitedCapacity(b, amount);
pusher.onNext(List.of(buffer));
}
if (unfulfilled == 0) {
// We're done! All data has been received.
assert closedExceptionally == null;
< prev index next >