Class DbxClientV1.Uploader

java.lang.Object
com.dropbox.core.v1.DbxClientV1.Uploader
Enclosing class:
DbxClientV1

public abstract static class DbxClientV1.Uploader extends Object
For uploading file content to Dropbox. Write stuff to the getBody() stream.

Don't call close() directly on the getBody(). Instead call either call either finish() or close() to make sure the stream and other resources are released. A safe idiom is to use the object within a try block and put a call to close() in the finally block.

 DbxClientV1.Uploader uploader = ...
 try {
     uploader.body.write("Hello, world!".getBytes("UTF-8"));
     uploader.finish();
 }
 finally {
     uploader.close();
 }
 
  • Constructor Details

    • Uploader

      public Uploader()
  • Method Details

    • getBody

      public abstract OutputStream getBody()
    • abort

      public abstract void abort()
      Cancel the upload.
    • close

      public abstract void close()
      Release the resources related to this Uploader instance. If close() or abort() has already been called, this does nothing. If neither has been called, this is equivalent to calling abort().
    • finish

      public abstract DbxEntry.File finish() throws DbxException
      When you're done writing the file contents to getBody(), call this to indicate that you're done. This will actually finish the underlying HTTP request and return the uploaded file's DbxEntry.
      Throws:
      DbxException