Class DbxClientV1
- java.lang.Object
- 
- com.dropbox.core.v1.DbxClientV1
 
- 
 public final class DbxClientV1 extends java.lang.ObjectUse this class to make remote calls to the Dropbox API. You'll need an access token first, normally acquired viaDbxWebAuth.This class has no mutable state, so it's thread safe as long as you pass in a thread safe HttpRequestorimplementation.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classDbxClientV1.DownloaderA pairing of a metadata and main content of a download.static classDbxClientV1.IODbxExceptionA DbxException wrapped inside an IOException.static classDbxClientV1.UploaderFor uploading file content to Dropbox.
 - 
Field SummaryFields Modifier and Type Field Description static java.lang.StringUSER_AGENT_ID
 - 
Constructor SummaryConstructors Constructor Description DbxClientV1(DbxRequestConfig requestConfig, java.lang.String accessToken)DbxClientV1(DbxRequestConfig requestConfig, java.lang.String accessToken, DbxHost host)The same asDbxClientV1(DbxRequestConfig, String)except you can also set the hostnames of the Dropbox API servers.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description longchunkedUploadAppend(java.lang.String uploadId, long uploadOffset, byte[] data)longchunkedUploadAppend(java.lang.String uploadId, long uploadOffset, byte[] data, int dataOffset, int dataLength)Append data to a chunked upload session.<E extends java.lang.Throwable>
 longchunkedUploadAppend(java.lang.String uploadId, long uploadOffset, long chunkSize, DbxStreamWriter<E> writer)Append a chunk of data to a chunked upload session.DbxEntry.FilechunkedUploadFinish(java.lang.String targetPath, DbxWriteMode writeMode, java.lang.String uploadId)Creates a file in the user's Dropbox at the given path, with file data previously uploaded viachunkedUploadFirst(byte[])andchunkedUploadAppend(java.lang.String, long, byte[]).java.lang.StringchunkedUploadFirst(byte[] data)Equivalent tochunkedUploadFirst(data, 0, data.length).java.lang.StringchunkedUploadFirst(byte[] data, int dataOffset, int dataLength)Upload the first chunk of a multi-chunk upload.<E extends java.lang.Throwable>
 java.lang.StringchunkedUploadFirst(int chunkSize, DbxStreamWriter<E> writer)Upload the first chunk of a multi-chunk upload.DbxEntrycopy(java.lang.String fromPath, java.lang.String toPath)Copy a file or folder from one path in Dropbox to another path in Dropbox.DbxEntrycopyFromCopyRef(java.lang.String copyRef, java.lang.String toPath)Create a file or folder attoPathbased on the given copy ref (created withcreateCopyRef(java.lang.String)).java.lang.StringcreateCopyRef(java.lang.String path)Creates and returns a "copy ref" to a file.DbxEntry.FoldercreateFolder(java.lang.String path)Create a new folder in Dropbox.java.lang.StringcreateShareableUrl(java.lang.String path)Creates and returns a publicly-shareable URL to a file or folder's "preview page".DbxUrlWithExpirationcreateTemporaryDirectUrl(java.lang.String path)Creates and returns a publicly-shareable URL to a file's contents.voiddelete(java.lang.String path)Delete a file or folder from Dropbox.voiddisableAccessToken()Disable the access token that you constructed thisDbxClientV1with.<T> TdoPost(java.lang.String host, java.lang.String path, java.lang.String[] params, java.util.ArrayList<HttpRequestor.Header> headers, DbxRequestUtil.ResponseHandler<T> handler)<E extends java.lang.Throwable>
 DbxEntry.FilefinishUploadFile(DbxClientV1.Uploader uploader, DbxStreamWriter<E> writer)java.lang.StringgetAccessToken()Returns theDbxAccessTokenthat was passed in to the constructor.DbxAccountInfogetAccountInfo()Retrieve the user's account information.DbxDelta<DbxEntry>getDelta(java.lang.String cursor)DbxDelta<DbxEntry>getDelta(java.lang.String cursor, boolean includeMediaInfo)Return "delta" entries for the contents of a user's Dropbox.<C> DbxDeltaC<C>getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor)<C> DbxDeltaC<C>getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, boolean includeMediaInfo)A more generic version ofgetDelta(java.lang.String, boolean).<C> DbxDeltaC<C>getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, java.lang.String pathPrefix)Same asgetDeltaCWithPathPrefix(Collector, String, String, boolean)withincludeMediaInfoset tofalse.<C> DbxDeltaC<C>getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, java.lang.String pathPrefix, boolean includeMediaInfo)A more generic version ofgetDeltaWithPathPrefix(java.lang.String, java.lang.String, boolean).java.lang.StringgetDeltaLatestCursor()java.lang.StringgetDeltaLatestCursor(boolean includeMediaInfo)Get a cursor for the current state of a user's Dropbox folder.java.lang.StringgetDeltaLatestCursorWithPathPrefix(java.lang.String pathPrefix)java.lang.StringgetDeltaLatestCursorWithPathPrefix(java.lang.String pathPrefix, boolean includeMediaInfo)Same asgetDeltaLatestCursor(boolean), except the cursor is limited to files and folders whose paths are equal to or under the specifiedpathPrefix.DbxDelta<DbxEntry>getDeltaWithPathPrefix(java.lang.String cursor, java.lang.String pathPrefix)DbxDelta<DbxEntry>getDeltaWithPathPrefix(java.lang.String cursor, java.lang.String pathPrefix, boolean includeMediaInfo)Same asgetDelta(java.lang.String, boolean), except results are limited to files and folders whose paths are equal to or under the specifiedpathPrefix.DbxEntry.FilegetFile(java.lang.String path, java.lang.String rev, java.io.OutputStream target)Retrieves a file's content and writes it to the givenOutputStream.DbxHostgetHost()Returns theDbxHostthat was passed in to the constructor.DbxLongpollDeltaResultgetLongpollDelta(java.lang.String cursor, int timeout)Waits for changes to files on an account, starting from the state represented bycursor.DbxEntrygetMetadata(java.lang.String path)DbxEntrygetMetadata(java.lang.String path, boolean includeMediaInfo)Get the file or folder metadata for a given path.DbxEntry.WithChildrengetMetadataWithChildren(java.lang.String path)DbxEntry.WithChildrengetMetadataWithChildren(java.lang.String path, boolean includeMediaInfo)Get the metadata for a given path; if the path refers to a folder, get all the children's metadata as well.<C> DbxEntry.WithChildrenC<C>getMetadataWithChildrenC(java.lang.String path, boolean includeMediaInfo, Collector<DbxEntry,? extends C> collector)Same asgetMetadataWithChildren(java.lang.String, boolean)except instead of always returning a list ofDbxEntryobjects, you specify aCollectorthat processes theDbxEntryobjects one by one and aggregates them however you want.<C> DbxEntry.WithChildrenC<C>getMetadataWithChildrenC(java.lang.String path, Collector<DbxEntry,? extends C> collector)Maybe<DbxEntry.WithChildren>getMetadataWithChildrenIfChanged(java.lang.String path, boolean includeMediaInfo, java.lang.String previousFolderHash)Get the metadata for a given path and its children if anything has changed since the last time you got them (as determined by the value ofDbxEntry.WithChildren.hashfrom the last result).Maybe<DbxEntry.WithChildren>getMetadataWithChildrenIfChanged(java.lang.String path, java.lang.String previousFolderHash)Same asgetMetadataWithChildrenIfChanged(String, boolean, String)withincludeMediaInfoset tofalse.<C> Maybe<DbxEntry.WithChildrenC<C>>getMetadataWithChildrenIfChangedC(java.lang.String path, boolean includeMediaInfo, java.lang.String previousFolderHash, Collector<DbxEntry,? extends C> collector)Same asgetMetadataWithChildrenIfChanged(java.lang.String, boolean, java.lang.String)except instead of always returning a list ofDbxEntryobjects, you specify aCollectorthat processes theDbxEntryobjects one by one and aggregates them however you want.<C> Maybe<DbxEntry.WithChildrenC<C>>getMetadataWithChildrenIfChangedC(java.lang.String path, java.lang.String previousFolderHash, Collector<DbxEntry,? extends C> collector)Same asgetMetadataWithChildrenIfChangedC(String, boolean, String, Collector)withincludeMediaInfoset tofalse.DbxRequestConfiggetRequestConfig()Returns theDbxRequestConfigthat was passed in to the constructor.java.util.List<DbxEntry.File>getRevisions(java.lang.String path)Gets the metadata for the current and past revisions of a file (up to some limit) at a given path.DbxEntry.FilegetThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, java.lang.String path, java.lang.String rev, java.io.OutputStream target)Downloads a thumbnail for the image file at the given path in Dropbox.DbxEntrymove(java.lang.String fromPath, java.lang.String toPath)Move a file or folder from one path in Dropbox to another path in Dropbox.DbxEntry.FilerestoreFile(java.lang.String path, java.lang.String rev)Takes a copy of the file at the given revision and saves it over the current latest copy.java.util.List<DbxEntry>searchFileAndFolderNames(java.lang.String basePath, java.lang.String query)Returns metadata for all files and folders whose name matches the query string.DbxClientV1.DownloaderstartGetFile(java.lang.String path, java.lang.String rev)Retrieve a file's content and content metadata.DbxClientV1.DownloaderstartGetThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, java.lang.String path, java.lang.String rev)Similar togetThumbnail(com.dropbox.core.v1.DbxThumbnailSize, com.dropbox.core.v1.DbxThumbnailFormat, java.lang.String, java.lang.String, java.io.OutputStream), except the thumbnail contents are returned via aDbxClientV1.Downloader.DbxClientV1.UploaderstartUploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes)Start an API request to upload a file to Dropbox.DbxClientV1.UploaderstartUploadFileChunked(int chunkSize, java.lang.String targetPath, DbxWriteMode writeMode, long numBytes)Similar tostartUploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long), except always uses the chunked upload API.DbxClientV1.UploaderstartUploadFileChunked(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes)Similar tostartUploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long), except always uses the chunked upload API.DbxClientV1.UploaderstartUploadFileSingle(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes)Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the /files_put API call.<E extends java.lang.Throwable>
 DbxEntry.FileuploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)Upload file contents to Dropbox, getting contents from the givenDbxStreamWriter.DbxEntry.FileuploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, java.io.InputStream contents)A wrapper arounduploadFile(String, DbxWriteMode, long, DbxStreamWriter)that lets you pass in anInputStream.<E extends java.lang.Throwable>
 DbxEntry.FileuploadFileChunked(int chunkSize, java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the chunked upload API.<E extends java.lang.Throwable>
 DbxEntry.FileuploadFileChunked(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the chunked upload API.<E extends java.lang.Throwable>
 DbxEntry.FileuploadFileSingle(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer)
 
- 
- 
- 
Field Detail- 
USER_AGENT_IDpublic static final java.lang.String USER_AGENT_ID - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
DbxClientV1public DbxClientV1(DbxRequestConfig requestConfig, java.lang.String accessToken) - Parameters:
- accessToken- The OAuth 2 access token (that you got from Dropbox) that gives your app the ability to make Dropbox API calls against some particular user's account. The standard way to get one of these is to use- DbxWebAuthto send your user through Dropbox's OAuth 2 authorization flow.
 
 - 
DbxClientV1public DbxClientV1(DbxRequestConfig requestConfig, java.lang.String accessToken, DbxHost host) The same asDbxClientV1(DbxRequestConfig, String)except you can also set the hostnames of the Dropbox API servers. This is used in testing. You don't normally need to call this.
 
- 
 - 
Method Detail- 
getRequestConfigpublic DbxRequestConfig getRequestConfig() Returns theDbxRequestConfigthat was passed in to the constructor.
 - 
getAccessTokenpublic java.lang.String getAccessToken() Returns theDbxAccessTokenthat was passed in to the constructor.
 - 
getHostpublic DbxHost getHost() Returns theDbxHostthat was passed in to the constructor.
 - 
getMetadatapublic DbxEntry getMetadata(java.lang.String path, boolean includeMediaInfo) throws DbxException Get the file or folder metadata for a given path.DbxClientV1 dbxClient = ... DbxEntry entry = dbxClient.getMetadata("/Photos"); if (entry == null) { System.out.println("No file or folder at that path."); } else { System.out.print(entry.toStringMultiline()); }- Parameters:
- path- The path to the file or folder (see- DbxPathV1).
- includeMediaInfo- If- true, then if the return value is a- DbxEntry.File, it might have its- photoInfoand- mediaInfofields filled in.
- Returns:
- If there is a file or folder at the given path, return the
    metadata for that path.  If there is no file or folder there,
    return null.
- Throws:
- DbxException
 
 - 
getMetadatapublic DbxEntry getMetadata(java.lang.String path) throws DbxException - Throws:
- DbxException
 
 - 
getMetadataWithChildrenpublic DbxEntry.WithChildren getMetadataWithChildren(java.lang.String path, boolean includeMediaInfo) throws DbxException Get the metadata for a given path; if the path refers to a folder, get all the children's metadata as well.DbxClientV1 dbxClient = ... DbxEntry entry = dbxClient.getMetadata("/Photos"); if (entry == null) { System.out.println("No file or folder at that path."); } else { System.out.print(entry.toStringMultiline()); }- Parameters:
- path- The path (starting with "/") to the file or folder (see- DbxPathV1).
- includeMediaInfo- If- true, then if the return value is a- DbxEntry.File, it might have its- photoInfoand- mediaInfofields filled in.
- Returns:
- If there is no file or folder at the given path, return null. Otherwise, return the metadata for that path and the metadata for all its immediate children (if it's a folder).
- Throws:
- DbxException
 
 - 
getMetadataWithChildrenpublic DbxEntry.WithChildren getMetadataWithChildren(java.lang.String path) throws DbxException - Throws:
- DbxException
 
 - 
getMetadataWithChildrenCpublic <C> DbxEntry.WithChildrenC<C> getMetadataWithChildrenC(java.lang.String path, boolean includeMediaInfo, Collector<DbxEntry,? extends C> collector) throws DbxException Same asgetMetadataWithChildren(java.lang.String, boolean)except instead of always returning a list ofDbxEntryobjects, you specify aCollectorthat processes theDbxEntryobjects one by one and aggregates them however you want.This allows your to process the DbxEntryvalues as they arrive, instead of having to wait for the entire API call to finish before processing the first one. Be careful, though, because the API call may fail in the middle (after you've already processed some entries). Make sure your code can handle that situation. For example, if you're inserting stuff into a database as they arrive, you might want do everything in a transaction and commit only if the entire call succeeds.- Throws:
- DbxException
 
 - 
getMetadataWithChildrenCpublic <C> DbxEntry.WithChildrenC<C> getMetadataWithChildrenC(java.lang.String path, Collector<DbxEntry,? extends C> collector) throws DbxException - Throws:
- DbxException
 
 - 
getMetadataWithChildrenIfChangedpublic Maybe<DbxEntry.WithChildren> getMetadataWithChildrenIfChanged(java.lang.String path, boolean includeMediaInfo, java.lang.String previousFolderHash) throws DbxException Get the metadata for a given path and its children if anything has changed since the last time you got them (as determined by the value ofDbxEntry.WithChildren.hashfrom the last result).- Parameters:
- path- The path (starting with "/") to the file or folder (see- DbxPathV1).
- previousFolderHash- The value of- DbxEntry.WithChildren.hashfrom the last time you got the metadata for this folder (and children).
- Returns:
- Never returns null. If the folder at the given path hasn't changed since you last retrieved it (i.e. its contents matchpreviousFolderHash), returnMaybe.Nothing. If it doesn't matchpreviousFolderHashreturn eitherMaybe.Just(null)if there's nothing there orMaybe.Justwith the metadata.
- Throws:
- DbxException
 
 - 
getMetadataWithChildrenIfChangedpublic Maybe<DbxEntry.WithChildren> getMetadataWithChildrenIfChanged(java.lang.String path, java.lang.String previousFolderHash) throws DbxException Same asgetMetadataWithChildrenIfChanged(String, boolean, String)withincludeMediaInfoset tofalse.- Throws:
- DbxException
 
 - 
getMetadataWithChildrenIfChangedCpublic <C> Maybe<DbxEntry.WithChildrenC<C>> getMetadataWithChildrenIfChangedC(java.lang.String path, boolean includeMediaInfo, java.lang.String previousFolderHash, Collector<DbxEntry,? extends C> collector) throws DbxException Same asgetMetadataWithChildrenIfChanged(java.lang.String, boolean, java.lang.String)except instead of always returning a list ofDbxEntryobjects, you specify aCollectorthat processes theDbxEntryobjects one by one and aggregates them however you want.This allows your to process the DbxEntryvalues as they arrive, instead of having to wait for the entire API call to finish before processing the first one. Be careful, though, because the API call may fail in the middle (after you've already processed some entries). Make sure your code can handle that situation. For example, if you're inserting stuff into a database as they arrive, you might want do everything in a transaction and commit only if the entire call succeeds.- Throws:
- DbxException
 
 - 
getMetadataWithChildrenIfChangedCpublic <C> Maybe<DbxEntry.WithChildrenC<C>> getMetadataWithChildrenIfChangedC(java.lang.String path, java.lang.String previousFolderHash, Collector<DbxEntry,? extends C> collector) throws DbxException Same asgetMetadataWithChildrenIfChangedC(String, boolean, String, Collector)withincludeMediaInfoset tofalse.- Throws:
- DbxException
 
 - 
getAccountInfopublic DbxAccountInfo getAccountInfo() throws DbxException Retrieve the user's account information.- Throws:
- DbxException
 
 - 
disableAccessTokenpublic void disableAccessToken() throws DbxExceptionDisable the access token that you constructed thisDbxClientV1with. After calling this, API calls made with thisDbxClientV1will fail.- Throws:
- DbxException
 
 - 
getFilepublic DbxEntry.File getFile(java.lang.String path, java.lang.String rev, java.io.OutputStream target) throws DbxException, java.io.IOException Retrieves a file's content and writes it to the givenOutputStream.DbxClientV1 dbxClient = ... DbxEntry.File md; File target = new File("Copy of House.jpeg"); OutputStream out = new FileOutputStream(target); try { md = dbxClient.getFile("/Photos/House.jpeg", out); } finally { out.close(); }- Parameters:
- rev- The- revof the file to retrieve, or- nullif you want the latest revision of the file.
- Returns:
- The downloaded file's metadata, or null
- Throws:
- java.io.IOException- If there's an error writing to- target.
- DbxException
 
 - 
startGetFilepublic DbxClientV1.Downloader startGetFile(java.lang.String path, java.lang.String rev) throws DbxException Retrieve a file's content and content metadata. You must call theDbxClientV1.Downloader'sclose()method; use atry/finally.DbxClientV1 dbxClient = ... DbxClientV1.Downloader downloader = dbxClient.startGetFile("/ReadMe.txt") try { printStream(downloader.body) } finally { downloader.close() }- Parameters:
- rev- The- revof the file to retrieve, or- nullif you want the latest revision of the file.
- path- The path (starting with "/") to the file or folder on Dropbox. (see- DbxPathV1).
- Returns:
- An object that can be used to download the file contents, or
     nullif there is no file at the requested path.
- Throws:
- DbxException
 
 - 
uploadFilepublic DbxEntry.File uploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, java.io.InputStream contents) throws DbxException, java.io.IOException A wrapper arounduploadFile(String, DbxWriteMode, long, DbxStreamWriter)that lets you pass in anInputStream. The entire streamcontentswill be uploaded.DbxClientV1 dbxClient = ... File f = new File("ReadMe.txt") dbxClient.uploadFile("/ReadMe.txt",DbxWriteMode.add(), f.length(), new FileInputStream(f))- Parameters:
- targetPath- The path to the file on Dropbox (see- DbxPathV1). If a file at that path already exists on Dropbox, then the- writeModeparameter will determine what happens.
- writeMode- Determines what to do if there's already a file at the given- targetPath.
- numBytes- The number of bytes in the given stream. Use- -1if you don't know.
- contents- The source of file contents. This stream will be automatically closed (whether or not the upload succeeds).
- Throws:
- java.io.IOException- If there's an error reading from- in.
- DbxException
 
 - 
uploadFilepublic <E extends java.lang.Throwable> DbxEntry.File uploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.Throwable Upload file contents to Dropbox, getting contents from the givenDbxStreamWriter.DbxClientV1 dbxClient = ... // Create a file on Dropbox with 100 3-digit random numbers, one per line. final int numRandoms = 100; int fileSize = numRandoms * 4; 3 digits, plus a newline dbxClient.uploadFile("/Randoms.txt",DbxWriteMode.add(), fileSize, new DbxStreamWriter<RuntimeException>() { public void write(OutputStream out) throws IOException { Random rand = new Random(); PrintWriter pw = new PrintWriter(out); for (int i = 0; i < numRandoms; i++) { pw.printf("%03d\n", rand.nextInt(1000)); } pw.flush(); } });- Parameters:
- targetPath- The path to the file on Dropbox (see- DbxPathV1). If a file at that path already exists on Dropbox, then the- writeModeparameter will determine what happens.
- writeMode- Determines what to do if there's already a file at the given- targetPath.
- numBytes- The number of bytes you're going to upload via the returned- DbxClientV1.Uploader. Use- -1if you don't know ahead of time.
- writer- A callback that will be called when it's time to actually write out the body of the file.
- Throws:
- E- If- writer.write()throws an exception, it will propagate out of this function.
- DbxException
- E extends java.lang.Throwable
 
 - 
startUploadFilepublic DbxClientV1.Uploader startUploadFile(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException Start an API request to upload a file to Dropbox. Returns aDbxClientV1.Uploaderobject that lets you actually send the file contents viaDbxClientV1.Uploader.getBody(). When you're done copying the file body, callDbxClientV1.Uploader.finish().You need to close the DbxClientV1.Uploaderwhen you're done with it. Use atry/finallyto make sure you close it in all cases.DbxClientV1 dbxClient = ... DbxClientV1.Uploader uploader = dbxClient.startUploadFile(...) DbxEntry.File md; try { writeMyData(uploader.body); md = uploader.finish(); } finally { uploader.close(); }- Parameters:
- targetPath- The path to the file on Dropbox (see- DbxPathV1). If a file at that path already exists on Dropbox, then the- writeModeparameter will determine what happens.
- writeMode- Determines what to do if there's already a file at the given- targetPath.
- numBytes- The number of bytes you're going to upload via the returned- DbxClientV1.Uploader. Use- -1if you don't know ahead of time.
- Throws:
- DbxException
 
 - 
finishUploadFilepublic <E extends java.lang.Throwable> DbxEntry.File finishUploadFile(DbxClientV1.Uploader uploader, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.Throwable - Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
startUploadFileSinglepublic DbxClientV1.Uploader startUploadFileSingle(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the /files_put API call. One difference is thatnumBytesmust not be negative.- Throws:
- DbxException
 
 - 
uploadFileSinglepublic <E extends java.lang.Throwable> DbxEntry.File uploadFileSingle(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.Throwable - Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
chunkedUploadFirstpublic java.lang.String chunkedUploadFirst(byte[] data) throws DbxExceptionEquivalent tochunkedUploadFirst(data, 0, data.length).- Throws:
- DbxException
 
 - 
chunkedUploadFirstpublic java.lang.String chunkedUploadFirst(byte[] data, int dataOffset, int dataLength) throws DbxExceptionUpload the first chunk of a multi-chunk upload.- Parameters:
- data- The data to append.
- dataOffset- The start offset in- datato read from.
- dataLength- The number of bytes to read from- data, starting from- dataOffset.
- Returns:
- The ID designated by the Dropbox server to identify the chunked upload.
- Throws:
- DbxException
 
 - 
chunkedUploadFirstpublic <E extends java.lang.Throwable> java.lang.String chunkedUploadFirst(int chunkSize, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.ThrowableUpload the first chunk of a multi-chunk upload.- Parameters:
- chunkSize- The number of bytes you're going to upload in this chunk.
- writer- A callback that will be called when it's time to actually write out the body of the chunk.
- Returns:
- The ID designated by the Dropbox server to identify the chunked upload.
- Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
chunkedUploadAppendpublic long chunkedUploadAppend(java.lang.String uploadId, long uploadOffset, byte[] data) throws DbxException- Throws:
- DbxException
 
 - 
chunkedUploadAppendpublic long chunkedUploadAppend(java.lang.String uploadId, long uploadOffset, byte[] data, int dataOffset, int dataLength) throws DbxExceptionAppend data to a chunked upload session.- Parameters:
- uploadId- The identifier returned by- chunkedUploadFirst(byte[])to identify the chunked upload session.
- uploadOffset- The current number of bytes uploaded to the chunked upload session. The server checks this value to make sure it is correct. If it is correct, the contents of- datais appended and -1 is returned. If it is incorrect, the correct offset is returned.
- data- The data to append.
- dataOffset- The start offset in- datato read from.
- dataLength- The number of bytes to read from- data, starting from- dataOffset.
- Returns:
- If everything goes correctly, returns -1. If the givenoffsetdidn't match the actual number of bytes in the chunked upload session, returns the correct number of bytes.
- Throws:
- DbxException
 
 - 
chunkedUploadAppendpublic <E extends java.lang.Throwable> long chunkedUploadAppend(java.lang.String uploadId, long uploadOffset, long chunkSize, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.ThrowableAppend a chunk of data to a chunked upload session.- Parameters:
- uploadId- The identifier returned by- chunkedUploadFirst(byte[])to identify the chunked upload session.
- uploadOffset- The current number of bytes uploaded to the chunked upload session. The server checks this value to make sure it is correct. If it is correct, the contents of- datais appended and -1 is returned. If it is incorrect, the correct offset is returned.
- chunkSize- The size of the chunk.
- writer- A callback that will be called when it's time to actually write out the body of the chunk.
- Returns:
- If everything goes correctly, returns -1. If the givenoffsetdidn't match the actual number of bytes in the chunked upload session, returns the correct number of bytes.
- Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
chunkedUploadFinishpublic DbxEntry.File chunkedUploadFinish(java.lang.String targetPath, DbxWriteMode writeMode, java.lang.String uploadId) throws DbxException Creates a file in the user's Dropbox at the given path, with file data previously uploaded viachunkedUploadFirst(byte[])andchunkedUploadAppend(java.lang.String, long, byte[]).- Parameters:
- targetPath- The path to the file on Dropbox (see- DbxPathV1). If a file at that path already exists on Dropbox, then the- writeModeparameter will determine what happens.
- writeMode- Determines what to do if there's already a file at the given- targetPath.
- uploadId- The identifier returned by- chunkedUploadFirst(byte[])to identify the uploaded data.
- Throws:
- DbxException
 
 - 
startUploadFileChunkedpublic DbxClientV1.Uploader startUploadFileChunked(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes) Similar tostartUploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long), except always uses the chunked upload API.
 - 
startUploadFileChunkedpublic DbxClientV1.Uploader startUploadFileChunked(int chunkSize, java.lang.String targetPath, DbxWriteMode writeMode, long numBytes) Similar tostartUploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long), except always uses the chunked upload API.
 - 
uploadFileChunkedpublic <E extends java.lang.Throwable> DbxEntry.File uploadFileChunked(java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.Throwable Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the chunked upload API.- Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
uploadFileChunkedpublic <E extends java.lang.Throwable> DbxEntry.File uploadFileChunked(int chunkSize, java.lang.String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends java.lang.Throwable Similar touploadFile(java.lang.String, com.dropbox.core.v1.DbxWriteMode, long, java.io.InputStream), except always uses the chunked upload API.- Throws:
- DbxException
- E extends java.lang.Throwable
 
 - 
getDeltapublic DbxDelta<DbxEntry> getDelta(java.lang.String cursor, boolean includeMediaInfo) throws DbxException Return "delta" entries for the contents of a user's Dropbox. This lets you efficiently keep up with the latest state of the files and folders. SeeDbxDeltafor more documentation on what each entry means.To start, pass in nullforcursor. For subsequent calls To get the next set of delta entries, pass in thecursorreturned by the previous call.To catch up to the current state, keep calling this method until the returned object's hasMorefield isfalse.If your app is a "Full Dropbox" app, this will return all entries for the user's entire Dropbox folder. If your app is an "App Folder" app, this will only return entries for the App Folder's contents. - Throws:
- DbxException
 
 - 
getDeltapublic DbxDelta<DbxEntry> getDelta(java.lang.String cursor) throws DbxException - Throws:
- DbxException
 
 - 
getDeltaCpublic <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, boolean includeMediaInfo) throws DbxException A more generic version ofgetDelta(java.lang.String, boolean). You provide a collector, which lets you process the delta entries as they arrive over the network.- Throws:
- DbxException
 
 - 
getDeltaCpublic <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor) throws DbxException - Throws:
- DbxException
 
 - 
getDeltaWithPathPrefixpublic DbxDelta<DbxEntry> getDeltaWithPathPrefix(java.lang.String cursor, java.lang.String pathPrefix, boolean includeMediaInfo) throws DbxException Same asgetDelta(java.lang.String, boolean), except results are limited to files and folders whose paths are equal to or under the specifiedpathPrefix.The pathPrefixis fixed for a given cursor. WhateverpathPrefixyou use on the first call togetDelta()must also be passed in on subsequent calls that use the returned cursor.- Parameters:
- pathPrefix- A path on Dropbox to limit results to.
- Throws:
- DbxException
 
 - 
getDeltaWithPathPrefixpublic DbxDelta<DbxEntry> getDeltaWithPathPrefix(java.lang.String cursor, java.lang.String pathPrefix) throws DbxException - Throws:
- DbxException
 
 - 
getDeltaCWithPathPrefixpublic <C> DbxDeltaC<C> getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, java.lang.String pathPrefix, boolean includeMediaInfo) throws DbxException A more generic version ofgetDeltaWithPathPrefix(java.lang.String, java.lang.String, boolean). You provide a collector, which lets you process the delta entries as they arrive over the network.- Throws:
- DbxException
 
 - 
getDeltaCWithPathPrefixpublic <C> DbxDeltaC<C> getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, java.lang.String cursor, java.lang.String pathPrefix) throws DbxException Same asgetDeltaCWithPathPrefix(Collector, String, String, boolean)withincludeMediaInfoset tofalse.- Throws:
- DbxException
 
 - 
getDeltaLatestCursorpublic java.lang.String getDeltaLatestCursor(boolean includeMediaInfo) throws DbxExceptionGet a cursor for the current state of a user's Dropbox folder. Can be passed togetDelta(java.lang.String, boolean)to retrieve changes since this method was called.- Throws:
- DbxException
 
 - 
getDeltaLatestCursorpublic java.lang.String getDeltaLatestCursor() throws DbxException- Throws:
- DbxException
 
 - 
getDeltaLatestCursorWithPathPrefixpublic java.lang.String getDeltaLatestCursorWithPathPrefix(java.lang.String pathPrefix, boolean includeMediaInfo) throws DbxExceptionSame asgetDeltaLatestCursor(boolean), except the cursor is limited to files and folders whose paths are equal to or under the specifiedpathPrefix.- Parameters:
- pathPrefix- A path on Dropbox to limit the cursor to.
- Throws:
- DbxException
 
 - 
getDeltaLatestCursorWithPathPrefixpublic java.lang.String getDeltaLatestCursorWithPathPrefix(java.lang.String pathPrefix) throws DbxException- Throws:
- DbxException
 
 - 
getLongpollDeltapublic DbxLongpollDeltaResult getLongpollDelta(java.lang.String cursor, int timeout) throws DbxException Waits for changes to files on an account, starting from the state represented bycursor.- Parameters:
- cursor- A cursor returned by ono of the "delta" methods.
- timeout- How long poll should run before timing out, in seconds.
- Throws:
- DbxException
 
 - 
getThumbnailpublic DbxEntry.File getThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, java.lang.String path, java.lang.String rev, java.io.OutputStream target) throws DbxException, java.io.IOException Downloads a thumbnail for the image file at the given path in Dropbox.- Parameters:
- sizeBound- The returned thumbnail will never be greater than the dimensions given here.
- format- The image format to use for thumbnail data.
- path- The path to the image file on Dropbox.
- rev- The- revof the file on Dropbox or- nullif you want the latest revision of the file.
- target- The stream to write the thumbnail image data to.
- Returns:
- The metadata for the original file (not the thumbnail) or nullif there is no file at that path.
- Throws:
- DbxException
- java.io.IOException
 
 - 
startGetThumbnailpublic DbxClientV1.Downloader startGetThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, java.lang.String path, java.lang.String rev) throws DbxException Similar togetThumbnail(com.dropbox.core.v1.DbxThumbnailSize, com.dropbox.core.v1.DbxThumbnailFormat, java.lang.String, java.lang.String, java.io.OutputStream), except the thumbnail contents are returned via aDbxClientV1.Downloader.- Throws:
- DbxException
 
 - 
getRevisionspublic java.util.List<DbxEntry.File> getRevisions(java.lang.String path) throws DbxException Gets the metadata for the current and past revisions of a file (up to some limit) at a given path.- Parameters:
- path- The Dropbox path that you want file revision metadata for.
- Returns:
- A list of metadata objects, one for each file revision.
- Throws:
- DbxException
 
 - 
restoreFilepublic DbxEntry.File restoreFile(java.lang.String path, java.lang.String rev) throws DbxException Takes a copy of the file at the given revision and saves it over the current latest copy. This will create a new revision, but the file contents will match the revision you specified.- Parameters:
- path- The Dropbox path of the file to restore.
- rev- The revision of the file you want to use to overwrite the latest revision.
- Returns:
- If the specified path/revcouldn't be found, returnnull. Otherwise, return metadata for the newly-created latest revision of the file.
- Throws:
- DbxException
 
 - 
searchFileAndFolderNamespublic java.util.List<DbxEntry> searchFileAndFolderNames(java.lang.String basePath, java.lang.String query) throws DbxException Returns metadata for all files and folders whose name matches the query string.- Parameters:
- basePath- The path to search under (recursively). Pass in- "/"to search everything.
- query- A space-separated list of substrings to search for. A file matches only if it contains all the substrings.
- Returns:
- The list of metadata entries that match the search query.
- Throws:
- DbxException
 
 - 
createShareableUrlpublic java.lang.String createShareableUrl(java.lang.String path) throws DbxExceptionCreates and returns a publicly-shareable URL to a file or folder's "preview page". This URL can be used without authentication. The preview page may contain a thumbnail or some other preview of the file, along with a link to download the actual filel.- Parameters:
- path- The Dropbox path to a file or folder.
- Returns:
- If there is no file or folder at that path, return null. Otherwise return a shareable URL.
- Throws:
- DbxException
 
 - 
createTemporaryDirectUrlpublic DbxUrlWithExpiration createTemporaryDirectUrl(java.lang.String path) throws DbxException Creates and returns a publicly-shareable URL to a file's contents. This URL can be used without authentication. This link will stop working after a few hours.- Parameters:
- path- The Dropbox path to a file.
- Returns:
- If there is no file at that path, return null. Otherwise return a shareable URL along with the expiration time.
- Throws:
- DbxException
 
 - 
createCopyRefpublic java.lang.String createCopyRef(java.lang.String path) throws DbxExceptionCreates and returns a "copy ref" to a file. A copy ref can be used to copy a file across different Dropbox accounts without downloading and re-uploading.For example, create a DbxClientV1using the access token from one account and callcreateCopyRef. Then, create aDbxClientV1using the access token for another account and callcopyFromCopyRefusing the copy ref.A copy ref created by an app can only be used by that app. - Parameters:
- path- The Dropbox path to a file.
- Returns:
- The copy ref's identifier, suitable for passing in to copyFromCopyRef(java.lang.String, java.lang.String), ornullif the specified path does not exist.
- Throws:
- DbxException
 
 - 
copypublic DbxEntry copy(java.lang.String fromPath, java.lang.String toPath) throws DbxException Copy a file or folder from one path in Dropbox to another path in Dropbox.- Returns:
- If successful, returns the metadata for new copy of the file or folder,
    otherwise returns null.
- Throws:
- DbxException
 
 - 
copyFromCopyRefpublic DbxEntry copyFromCopyRef(java.lang.String copyRef, java.lang.String toPath) throws DbxException Create a file or folder attoPathbased on the given copy ref (created withcreateCopyRef(java.lang.String)).- Throws:
- DbxException
 
 - 
createFolderpublic DbxEntry.Folder createFolder(java.lang.String path) throws DbxException Create a new folder in Dropbox.- Returns:
- If successful, returns the metadata for the newly created folder, otherwise
    returns null.
- Throws:
- DbxException
 
 - 
deletepublic void delete(java.lang.String path) throws DbxExceptionDelete a file or folder from Dropbox.- Throws:
- DbxException
 
 - 
movepublic DbxEntry move(java.lang.String fromPath, java.lang.String toPath) throws DbxException Move a file or folder from one path in Dropbox to another path in Dropbox.- Returns:
- If successful, returns the metadata for the file or folder at its new location,
    otherwise returns null.
- Throws:
- DbxException
 
 - 
doPostpublic <T> T doPost(java.lang.String host, java.lang.String path, java.lang.String[] params, java.util.ArrayList<HttpRequestor.Header> headers, DbxRequestUtil.ResponseHandler<T> handler) throws DbxException- Throws:
- DbxException
 
 
- 
 
-