use of com.dropbox.core.v2.files.UploadSessionAppendV2Uploader in project cyberduck by iterate-ch.
the class DropboxWriteFeature method write.
@Override
public HttpResponseOutputStream<Metadata> write(final Path file, final TransferStatus status, final ConnectionCallback callback) throws BackgroundException {
try {
final DbxUserFilesRequests files = new DbxUserFilesRequests(session.getClient(file));
final UploadSessionStartUploader start = files.uploadSessionStart();
new DefaultStreamCloser().close(start.getOutputStream());
final String sessionId = start.finish().getSessionId();
if (log.isDebugEnabled()) {
log.debug(String.format("Obtained session id %s for upload %s", sessionId, file));
}
final UploadSessionAppendV2Uploader uploader = open(files, sessionId, 0L);
return new SegmentingUploadProxyOutputStream(file, status, files, uploader, sessionId);
} catch (DbxException ex) {
throw new DropboxExceptionMappingService().map("Upload failed.", ex, file);
}
}
Aggregations