Class DbxWriteMode


  • public final class DbxWriteMode
    extends java.lang.Object
    Describes how a file should be saved when it is written to Dropbox. Do not call the constructor. Instead, call one of the three static functions: add(), force(), update(java.lang.String).
    • Method Detail

      • add

        public static DbxWriteMode add()
        Returns a DbxWriteMode for adding new file. If a file at the specified path already exists, the new file will be renamed automatically.

        For example, if you're trying to upload a file to "/Hello.txt", but there's already something there, your file will be written to "/Notes/Groceries (1).txt".

        You can determine whether your file was renamed by checking the DbxEntry.name returned by the API call.

      • force

        public static DbxWriteMode force()
        Returns a DbxWriteMode for forcing a file to be at a certain path. If there's already a file at that path, the existing file will be overwritten. If there's a folder at that path, however, it will not be overwritten and the API call will fail.
      • update

        public static DbxWriteMode update​(java.lang.String revisionToReplace)
        Returns a DbxWriteMode for updating an existing file. This is useful for when you have downloaded a file and made modifications and want to save your modifications back to Dropbox. You need to specify the revision of the copy of the file you downloaded (it's in DbxEntry.File.rev).

        If, when you attempt to save, the revision of the file currently on Dropbox matches revisionToReplace, the file on Dropbox will be overwritten with the new contents you provide.

        If the rev of the file currently on Dropbox doesn't match revisionToReplace, Dropbox leave the original file alone and save your contents to a new file. For example, if the original file path is "/Notes/Groceries.txt", the new file's path might be "/Notes/Groceries (conflicted copy).txt".

        You can determine whether your file was renamed by checking the DbxEntry.name returned by the API call.