Trying to upload big files with below code.
String upload_id = dbxFiles.uploadSessionStart().finish().getSessionId();
byte[] temp = new byte[CHUNK];
int size = inputStream.available();
int cursor = 0;
while (cursor < size) {
int totalRead = 0;
if ((size - cursor) < CHUNK) {
temp = new byte[size - cursor];
totalRead = inputStream.read(temp, 0, size - cursor);
} else {
totalRead = inputStream.read(temp, 0, CHUNK);
}
dbxFiles.uploadSessionAppend(upload_id, cursor).uploadAndFinish(new ByteArrayInputStream(temp));
cursor += totalRead;
}
uploadFileMetadata = dbxFiles.uploadSessionFinish(new UploadSessionCursor(upload_id, cursor),
new CommitInfo(path, WriteMode.ADD, true, new Date(), false)).uploadAndFinish(inputStream);
But the size of uploaded files are drastically changed. Can you please help me out