Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,20 @@ public void upload(final List<Option> options,
byte[] buffer = new byte[chunkSize];

while (this.readSoFar < this.streamSize) {
int read = this.inputStream.read(buffer);

if (read == -1) {
break;
int buffRead = 0;

// inner loop is to work-around the case where read buffer size is limited to less than chunk size by a global setting
while (buffRead < chunkSize) {
int read = 0;
read = this.inputStream.read(buffer, buffRead, chunkSize - buffRead);
if (read == -1) {
break;
}
buffRead += read;
}

ChunkedUploadRequest request =
new ChunkedUploadRequest(this.uploadUrl, this.client, options, buffer, read,
new ChunkedUploadRequest(this.uploadUrl, this.client, options, buffer, buffRead,
maxRetry, this.readSoFar, this.streamSize);
ChunkedUploadResult<UploadType> result = request.upload(this.responseHandler);

Expand All @@ -190,7 +196,7 @@ public void upload(final List<Option> options,
break;
}

this.readSoFar += read;
this.readSoFar += buffRead;
}
}

Expand Down