Class DbxClientV1.Uploader

  • Enclosing class:
    DbxClientV1

    public abstract static class DbxClientV1.Uploader
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      Uploader()  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      abstract void abort()
      Cancel the upload.
      abstract void close()
      Release the resources related to this Uploader instance.
      abstract DbxEntry.File finish()
      When you're done writing the file contents to getBody(), call this to indicate that you're done.
      abstract java.io.OutputStream getBody()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Uploader

        public Uploader()
    • Method Detail

      • getBody

        public abstract java.io.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