public final class DbxWriteMode extends Object
add()
,
force()
, update(java.lang.String)
.Modifier and Type | Method and Description |
---|---|
static DbxWriteMode |
add()
Returns a
DbxWriteMode for adding new file. |
static DbxWriteMode |
force()
Returns a
DbxWriteMode for forcing a file to be at a certain path. |
static DbxWriteMode |
update(String revisionToReplace)
Returns a
DbxWriteMode for updating an existing file. |
public static DbxWriteMode add()
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.
public static DbxWriteMode force()
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.public static DbxWriteMode update(String revisionToReplace)
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.
Copyright © 2014. All rights reserved.