@Test(expected = AccessDeniedException.class) public void testWriteDesktopIni() throws Exception { final DropboxWriteFeature write = new DropboxWriteFeature(session); final TransferStatus status = new TransferStatus(); final byte[] content = RandomUtils.nextBytes(0); status.setLength(content.length); final Path test = new Path(new DropboxHomeFinderFeature(session).find(), "desktop.ini", EnumSet.of(Path.Type.file)); final OutputStream out = write.write(test, status, new DisabledConnectionCallback()); new StreamCopier(new TransferStatus(), new TransferStatus()).transfer(new ByteArrayInputStream(content), out); }
@Override public HttpResponseOutputStream<String> 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); } }
DropboxWriteFeature extends AbstractHttpWriteFeature<String> { @Override public HttpResponseOutputStream<String> 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); } } }
DropboxWriteFeature extends AbstractHttpWriteFeature<String> { @Override public HttpResponseOutputStream<String> 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); } } DropboxWriteFeature(final DropboxSession session);  DropboxWriteFeature(final DropboxSession session, final Long chunksize);  DropboxWriteFeature(final DropboxSession session, final Find finder, final AttributesFinder attributes, final Long chunksize); }
DropboxWriteFeature extends AbstractHttpWriteFeature<String> { @Override public HttpResponseOutputStream<String> 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); } } DropboxWriteFeature(final DropboxSession session);  DropboxWriteFeature(final DropboxSession session, final Long chunksize);  DropboxWriteFeature(final DropboxSession session, final Find finder, final AttributesFinder attributes, final Long chunksize); @Override Append append(final Path file, final Long length, final Cache<Path> cache); @Override HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override boolean temporary(); @Override boolean random(); }
DropboxWriteFeature extends AbstractHttpWriteFeature<String> { @Override public HttpResponseOutputStream<String> 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); } } DropboxWriteFeature(final DropboxSession session);  DropboxWriteFeature(final DropboxSession session, final Long chunksize);  DropboxWriteFeature(final DropboxSession session, final Find finder, final AttributesFinder attributes, final Long chunksize); @Override Append append(final Path file, final Long length, final Cache<Path> cache); @Override HttpResponseOutputStream<String> write(final Path file, final TransferStatus status, final ConnectionCallback callback); @Override boolean temporary(); @Override boolean random();  }