zymap commented on code in PR #22722:
URL: https://github.com/apache/pulsar/pull/22722#discussion_r1604249671
##########
tiered-storage/jcloud/src/main/java/org/apache/bookkeeper/mledger/offload/jcloud/impl/BlobStoreBackedInputStreamImpl.java:
##########
@@ -135,6 +133,20 @@ private boolean refillBufferIfNeeded() throws IOException {
return true;
}
+ void fillBuffer(InputStream is, int bytesToCopy) throws IOException {
+ while (bytesToCopy > 0) {
+ int writeBytes = buffer.writeBytes(is, bytesToCopy);
+ if (writeBytes < 0) {
Review Comment:
The InputStream API said:
> * <p> If the length of {@code b} is zero, then no bytes are read and
> * {@code 0} is returned; otherwise, there is an attempt to read at
> * least one byte. If no byte is available because the stream is at the
> * end of the file, the value {@code -1} is returned; otherwise, at
> * least one byte is read and stored into {@code b}.
I would think the 0 does not happen when the buffer size > 0. Except we use
an empty buffer to read the stream.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]