public final class DbxClient extends Object
DbxWebAuth
.
This class has no mutable state, so it's thread safe as long as you pass in a thread safe
HttpRequestor
implementation.
Modifier and Type | Class and Description |
---|---|
static class |
DbxClient.Downloader
A pairing of a metadata and main content of a download.
|
static class |
DbxClient.IODbxException
A DbxException wrapped inside an IOException.
|
static class |
DbxClient.Uploader
For uploading file content to Dropbox.
|
Constructor and Description |
---|
DbxClient(DbxRequestConfig requestConfig,
String accessToken) |
DbxClient(DbxRequestConfig requestConfig,
String accessToken,
DbxHost host)
The same as
DbxClient(DbxRequestConfig, String) except you can also set the
hostnames of the Dropbox API servers. |
Modifier and Type | Method and Description |
---|---|
long |
chunkedUploadAppend(String uploadId,
long uploadOffset,
byte[] data)
|
long |
chunkedUploadAppend(String uploadId,
long uploadOffset,
byte[] data,
int dataOffset,
int dataLength)
Append data to a chunked upload session.
|
<E extends Throwable> |
chunkedUploadAppend(String uploadId,
long uploadOffset,
long chunkSize,
DbxStreamWriter<E> writer)
Append a chunk of data to a chunked upload session.
|
DbxEntry.File |
chunkedUploadFinish(String targetPath,
DbxWriteMode writeMode,
String uploadId)
Creates a file in the user's Dropbox at the given path, with file data previously uploaded
via
chunkedUploadFirst(byte[]) and chunkedUploadAppend(java.lang.String, long, byte[]) . |
String |
chunkedUploadFirst(byte[] data)
Equivalent to
chunkedUploadFirst(data, 0, data.length) . |
String |
chunkedUploadFirst(byte[] data,
int dataOffset,
int dataLength)
Upload the first chunk of a multi-chunk upload.
|
<E extends Throwable> |
chunkedUploadFirst(int chunkSize,
DbxStreamWriter<E> writer)
Upload the first chunk of a multi-chunk upload.
|
DbxEntry |
copy(String fromPath,
String toPath)
Copy a file or folder from one path in Dropbox to another path in Dropbox.
|
DbxEntry |
copyFromCopyRef(String copyRef,
String toPath)
Create a file or folder at
toPath based on the given copy ref (created with
createCopyRef(java.lang.String) ). |
String |
createCopyRef(String path)
Creates and returns a "copy ref" to a file.
|
DbxEntry.Folder |
createFolder(String path)
Create a new folder in Dropbox.
|
String |
createShareableUrl(String path)
Creates and returns a publicly-shareable URL to a file or folder's "preview page".
|
DbxUrlWithExpiration |
createTemporaryDirectUrl(String path)
Creates and returns a publicly-shareable URL to a file's contents.
|
void |
delete(String path)
Delete a file or folder from Dropbox.
|
void |
disableAccessToken()
Disable the access token that you constructed this
DbxClient
with. |
<T> T |
doPost(String host,
String path,
String[] params,
ArrayList<HttpRequestor.Header> headers,
DbxRequestUtil.ResponseHandler<T> handler) |
<E extends Throwable> |
finishUploadFile(DbxClient.Uploader uploader,
DbxStreamWriter<E> writer) |
String |
getAccessToken()
Returns the
DbxAccessToken that was passed in to the constructor. |
DbxAccountInfo |
getAccountInfo()
Retrieve the user's account information.
|
DbxDelta<DbxEntry> |
getDelta(String cursor)
Return "delta" entries for the contents of a user's Dropbox.
|
<C> DbxDeltaC<C> |
getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector,
String cursor)
A more generic version of
getDelta(java.lang.String) . |
<C> DbxDeltaC<C> |
getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector,
String cursor,
String pathPrefix)
A more generic version of
getDeltaWithPathPrefix(java.lang.String, java.lang.String) . |
DbxDelta<DbxEntry> |
getDeltaWithPathPrefix(String cursor,
String pathPrefix)
Same as
getDelta(java.lang.String) , except results are limited to files and folders whose
paths are equal to or under the specified pathPrefix . |
DbxEntry.File |
getFile(String path,
String rev,
OutputStream target)
Retrieves a file's content and writes it to the given
OutputStream . |
DbxEntry |
getMetadata(String path)
Get the file or folder metadata for a given path.
|
DbxEntry.WithChildren |
getMetadataWithChildren(String path)
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(String path,
Collector<DbxEntry,? extends C> collector)
Same as
getMetadataWithChildren(java.lang.String) except instead of always returning a list of
DbxEntry objects, you specify a Collector that processes the DbxEntry
objects one by one and aggregates them however you want. |
Maybe<DbxEntry.WithChildren> |
getMetadataWithChildrenIfChanged(String path,
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
of
DbxEntry.WithChildren.hash from the last result). |
<C> Maybe<DbxEntry.WithChildrenC<C>> |
getMetadataWithChildrenIfChangedC(String path,
String previousFolderHash,
Collector<DbxEntry,? extends C> collector)
Same as
getMetadataWithChildrenIfChanged(java.lang.String, java.lang.String) except instead of always returning a list of
DbxEntry objects, you specify a Collector that processes the DbxEntry
objects one by one and aggregates them however you want. |
DbxRequestConfig |
getRequestConfig()
Returns the
DbxRequestConfig that was passed in to the constructor. |
List<DbxEntry.File> |
getRevisions(String path)
Gets the metadata for the current and past revisions of a file (up to some limit) at
a given path.
|
DbxEntry.File |
getThumbnail(DbxThumbnailSize sizeBound,
DbxThumbnailFormat format,
String path,
String rev,
OutputStream target)
Downloads a thumbnail for the image file at the given path in Dropbox.
|
DbxEntry |
move(String fromPath,
String toPath)
Move a file or folder from one path in Dropbox to another path in Dropbox.
|
DbxEntry.File |
restoreFile(String path,
String rev)
Takes a copy of the file at the given revision and saves it over the current latest copy.
|
List<DbxEntry> |
searchFileAndFolderNames(String basePath,
String query)
Returns metadata for all files and folders whose name matches the query string.
|
DbxClient.Downloader |
startGetFile(String path,
String rev)
Retrieve a file's content and content metadata.
|
DbxClient.Downloader |
startGetThumbnail(DbxThumbnailSize sizeBound,
DbxThumbnailFormat format,
String path,
String rev)
Similar to
getThumbnail(com.dropbox.core.DbxThumbnailSize, com.dropbox.core.DbxThumbnailFormat, java.lang.String, java.lang.String, java.io.OutputStream) , except the thumbnail contents are returned via
a DbxClient.Downloader . |
DbxClient.Uploader |
startUploadFile(String targetPath,
DbxWriteMode writeMode,
long numBytes)
Start an API request to upload a file to Dropbox.
|
DbxClient.Uploader |
startUploadFileChunked(int chunkSize,
String targetPath,
DbxWriteMode writeMode,
long numBytes)
Similar to
startUploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long) , except always uses the chunked upload API. |
DbxClient.Uploader |
startUploadFileChunked(String targetPath,
DbxWriteMode writeMode,
long numBytes)
Similar to
startUploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long) , except always uses the chunked upload API. |
DbxClient.Uploader |
startUploadFileSingle(String targetPath,
DbxWriteMode writeMode,
long numBytes)
Similar to
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream) , except always uses the /files_put API call. |
<E extends Throwable> |
uploadFile(String targetPath,
DbxWriteMode writeMode,
long numBytes,
DbxStreamWriter<E> writer)
Upload file contents to Dropbox, getting contents from the given
DbxStreamWriter . |
DbxEntry.File |
uploadFile(String targetPath,
DbxWriteMode writeMode,
long numBytes,
InputStream contents)
A wrapper around
uploadFile(String, DbxWriteMode, long, DbxStreamWriter) that
lets you pass in an InputStream . |
<E extends Throwable> |
uploadFileChunked(int chunkSize,
String targetPath,
DbxWriteMode writeMode,
long numBytes,
DbxStreamWriter<E> writer)
Similar to
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream) , except always uses the chunked upload API. |
<E extends Throwable> |
uploadFileChunked(String targetPath,
DbxWriteMode writeMode,
long numBytes,
DbxStreamWriter<E> writer)
Similar to
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream) , except always uses the chunked upload API. |
<E extends Throwable> |
uploadFileSingle(String targetPath,
DbxWriteMode writeMode,
long numBytes,
DbxStreamWriter<E> writer) |
public DbxClient(DbxRequestConfig requestConfig, String accessToken)
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 DbxWebAuth
to send your user through Dropbox's
OAuth 2 authorization flow.public DbxClient(DbxRequestConfig requestConfig, String accessToken, DbxHost host)
DbxClient(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.public DbxRequestConfig getRequestConfig()
DbxRequestConfig
that was passed in to the constructor.public String getAccessToken()
DbxAccessToken
that was passed in to the constructor.public DbxEntry getMetadata(String path) throws DbxException
DbxClient 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()); }
path
- The path to the file or folder (see DbxPath
).null
.DbxException
public DbxEntry.WithChildren getMetadataWithChildren(String path) throws DbxException
DbxClient 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()); }
path
- The path (starting with "/") to the file or folder (see DbxPath
).null
.
Otherwise, return the metadata for that path and the metadata for all its immediate
children (if it's a folder).DbxException
public <C> DbxEntry.WithChildrenC<C> getMetadataWithChildrenC(String path, Collector<DbxEntry,? extends C> collector) throws DbxException
getMetadataWithChildren(java.lang.String)
except instead of always returning a list of
DbxEntry
objects, you specify a Collector
that processes the DbxEntry
objects one by one and aggregates them however you want.
This allows your to process the DbxEntry
values 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.
DbxException
public Maybe<DbxEntry.WithChildren> getMetadataWithChildrenIfChanged(String path, String previousFolderHash) throws DbxException
DbxEntry.WithChildren.hash
from the last result).path
- The path (starting with "/") to the file or folder (see DbxPath
).previousFolderHash
- The value of DbxEntry.WithChildren.hash
from the last time
you got the metadata for this folder (and children).null
. If the folder at the given path hasn't changed
since you last retrieved it (i.e. its contents match previousFolderHash
), return
Maybe.Nothing
. If it doesn't match previousFolderHash
return either
Maybe.Just(null)
if there's nothing there or Maybe.Just
with the
metadata.DbxException
public <C> Maybe<DbxEntry.WithChildrenC<C>> getMetadataWithChildrenIfChangedC(String path, String previousFolderHash, Collector<DbxEntry,? extends C> collector) throws DbxException
getMetadataWithChildrenIfChanged(java.lang.String, java.lang.String)
except instead of always returning a list of
DbxEntry
objects, you specify a Collector
that processes the DbxEntry
objects one by one and aggregates them however you want.
This allows your to process the DbxEntry
values 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.
DbxException
public DbxAccountInfo getAccountInfo() throws DbxException
DbxException
public void disableAccessToken() throws DbxException
DbxClient
with. After calling this, API calls made with this DbxClient
will
fail.DbxException
public DbxEntry.File getFile(String path, String rev, OutputStream target) throws DbxException, IOException
OutputStream
.
DbxClient 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(); }
rev
- The rev
of the file to retrieve,
or null
if you want the latest revision of the file.null
IOException
- If there's an error writing to target
.DbxException
public DbxClient.Downloader startGetFile(String path, String rev) throws DbxException
DbxClient.Downloader
's
close()
method; use a try
/finally
.
DbxClient dbxClient = ... DbxClient.Downloader downloader = dbxClient.startGetFile("/ReadMe.txt") try { printStream(downloader.body) } finally { downloader.close() }
rev
- The rev
of the file to retrieve,
or null
if you want the latest revision of the file.path
- The path (starting with "/") to the file or folder on Dropbox.
(see DbxPath
).null
if there is no file at the requested path.DbxException
public DbxEntry.File uploadFile(String targetPath, DbxWriteMode writeMode, long numBytes, InputStream contents) throws DbxException, IOException
uploadFile(String, DbxWriteMode, long, DbxStreamWriter)
that
lets you pass in an InputStream
. The entire stream contents
will
be uploaded.
DbxClient dbxClient = ...
File f = new File("ReadMe.txt")
dbxClient.uploadFile("/ReadMe.txt", DbxWriteMode.add()
, f.length(), new FileInputStream(f))
targetPath
- The path to the file on Dropbox (see DbxPath
). If a file at
that path already exists on Dropbox, then the writeMode
parameter
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 -1
if you don't know.contents
- The source of file contents. This stream will be automatically closed (whether or not the
upload succeeds).IOException
- If there's an error reading from in
.DbxException
public <E extends Throwable> DbxEntry.File uploadFile(String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
DbxStreamWriter
.
DbxClient 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();
}
});
targetPath
- The path to the file on Dropbox (see DbxPath
). If a file at
that path already exists on Dropbox, then the writeMode
parameter
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 DbxClient.Uploader
.
Use -1
if 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.E
- If writer.write()
throws an exception, it will propagate out of this function.DbxException
E extends Throwable
public DbxClient.Uploader startUploadFile(String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException
DbxClient.Uploader
object
that lets you actually send the file contents via DbxClient.Uploader.getBody()
. When
you're done copying the file body, call DbxClient.Uploader.finish()
.
You need to close the DbxClient.Uploader
when you're done with it.
Use a try
/finally
to make sure you close it in all cases.
DbxClient dbxClient = ... DbxClient.Uploader uploader = dbxClient.startUploadFile(...) DbxEntry.File md; try { writeMyData(uploader.body); md = uploader.finish(); } finally { uploader.close(); }
targetPath
- The path to the file on Dropbox (see DbxPath
). If a file at
that path already exists on Dropbox, then the writeMode
parameter
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 DbxClient.Uploader
.
Use -1
if you don't know ahead of time.DbxException
public <E extends Throwable> DbxEntry.File finishUploadFile(DbxClient.Uploader uploader, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
DbxException
E extends Throwable
public DbxClient.Uploader startUploadFileSingle(String targetPath, DbxWriteMode writeMode, long numBytes) throws DbxException
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream)
, except always uses the /files_put API call.
One difference is that numBytes
must not be negative.DbxException
public <E extends Throwable> DbxEntry.File uploadFileSingle(String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
DbxException
E extends Throwable
public String chunkedUploadFirst(byte[] data) throws DbxException
chunkedUploadFirst(data, 0, data.length)
.DbxException
public String chunkedUploadFirst(byte[] data, int dataOffset, int dataLength) throws DbxException
data
- The data to append.dataOffset
- The start offset in data
to read from.dataLength
- The number of bytes to read from data
, starting from dataOffset
.DbxException
public <E extends Throwable> String chunkedUploadFirst(int chunkSize, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
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.DbxException
E extends Throwable
public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data) throws DbxException
DbxException
public long chunkedUploadAppend(String uploadId, long uploadOffset, byte[] data, int dataOffset, int dataLength) throws DbxException
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 data
is appended and -1 is returned. If it is incorrect, the correct offset is returned.data
- The data to append.dataOffset
- The start offset in data
to read from.dataLength
- The number of bytes to read from data
, starting from dataOffset
.-1
. If the given offset
didn't
match the actual number of bytes in the chunked upload session, returns the correct
number of bytes.DbxException
public <E extends Throwable> long chunkedUploadAppend(String uploadId, long uploadOffset, long chunkSize, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
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 data
is 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.-1
. If the given offset
didn't
match the actual number of bytes in the chunked upload session, returns the correct
number of bytes.DbxException
E extends Throwable
public DbxEntry.File chunkedUploadFinish(String targetPath, DbxWriteMode writeMode, String uploadId) throws DbxException
chunkedUploadFirst(byte[])
and chunkedUploadAppend(java.lang.String, long, byte[])
.targetPath
- The path to the file on Dropbox (see DbxPath
). If a file at
that path already exists on Dropbox, then the writeMode
parameter
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.DbxException
public DbxClient.Uploader startUploadFileChunked(String targetPath, DbxWriteMode writeMode, long numBytes)
startUploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long)
, except always uses the chunked upload API.public DbxClient.Uploader startUploadFileChunked(int chunkSize, String targetPath, DbxWriteMode writeMode, long numBytes)
startUploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long)
, except always uses the chunked upload API.public <E extends Throwable> DbxEntry.File uploadFileChunked(String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream)
, except always uses the chunked upload API.DbxException
E extends Throwable
public <E extends Throwable> DbxEntry.File uploadFileChunked(int chunkSize, String targetPath, DbxWriteMode writeMode, long numBytes, DbxStreamWriter<E> writer) throws DbxException, E extends Throwable
uploadFile(java.lang.String, com.dropbox.core.DbxWriteMode, long, java.io.InputStream)
, except always uses the chunked upload API.DbxException
E extends Throwable
public DbxDelta<DbxEntry> getDelta(String cursor) throws DbxException
DbxDelta
for more documentation on what each entry means.
To start, pass in null
for cursor
. For subsequent calls
To get the next set of delta entries, pass in the cursor
returned
by the previous call.
To catch up to the current state, keep calling this method until the returned
object's hasMore
field is false
.
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.
DbxException
public <C> DbxDeltaC<C> getDeltaC(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, String cursor) throws DbxException
getDelta(java.lang.String)
. You provide a collector,
which lets you process the delta entries as they arrive over the network.DbxException
public DbxDelta<DbxEntry> getDeltaWithPathPrefix(String cursor, String pathPrefix) throws DbxException
getDelta(java.lang.String)
, except results are limited to files and folders whose
paths are equal to or under the specified pathPrefix
.
The pathPrefix
is fixed for a given cursor. Whatever pathPrefix
you use on the first call to getDelta()
must also be passed in on
subsequent calls that use the returned cursor.
pathPrefix
- A path on Dropbox to limit results to.DbxException
public <C> DbxDeltaC<C> getDeltaCWithPathPrefix(Collector<DbxDeltaC.Entry<DbxEntry>,C> collector, String cursor, String pathPrefix) throws DbxException
getDeltaWithPathPrefix(java.lang.String, java.lang.String)
. You provide a collector,
which lets you process the delta entries as they arrive over the network.DbxException
public DbxEntry.File getThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, String path, String rev, OutputStream target) throws DbxException, IOException
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 rev
of the file on Dropbox
or null
if you want the latest revision of the file.target
- The stream to write the thumbnail image data to.null
if there
is no file at that path.DbxException
IOException
public DbxClient.Downloader startGetThumbnail(DbxThumbnailSize sizeBound, DbxThumbnailFormat format, String path, String rev) throws DbxException
getThumbnail(com.dropbox.core.DbxThumbnailSize, com.dropbox.core.DbxThumbnailFormat, java.lang.String, java.lang.String, java.io.OutputStream)
, except the thumbnail contents are returned via
a DbxClient.Downloader
.DbxException
public List<DbxEntry.File> getRevisions(String path) throws DbxException
path
- The Dropbox path that you want file revision metadata for.DbxException
public DbxEntry.File restoreFile(String path, String rev) throws DbxException
path
- The Dropbox path of the file to restore.rev
- The revision of the file you want to use to overwrite the latest revision.path
/rev
couldn't be found, return null
.
Otherwise, return metadata for the newly-created latest revision of the file.DbxException
public List<DbxEntry> searchFileAndFolderNames(String basePath, String query) throws DbxException
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.DbxException
public String createShareableUrl(String path) throws DbxException
path
- The Dropbox path to a file or folder.null
. Otherwise return
a shareable URL.DbxException
public DbxUrlWithExpiration createTemporaryDirectUrl(String path) throws DbxException
path
- The Dropbox path to a file.null
. Otherwise return
a shareable URL along with the expiration time.DbxException
public String createCopyRef(String path) throws DbxException
For example, create a DbxClient
using the access token from one account and call
createCopyRef
. Then, create a DbxClient
using the access token for another
account and call copyFromCopyRef
using the copy ref.
A copy ref created by an app can only be used by that app.
path
- The Dropbox path to a file.copyFromCopyRef(java.lang.String, java.lang.String)
,
or null
if the specified path does not exist.DbxException
public DbxEntry copy(String fromPath, String toPath) throws DbxException
null
.DbxException
public DbxEntry copyFromCopyRef(String copyRef, String toPath) throws DbxException
toPath
based on the given copy ref (created with
createCopyRef(java.lang.String)
).DbxException
public DbxEntry.Folder createFolder(String path) throws DbxException
null
.DbxException
public void delete(String path) throws DbxException
DbxException
public DbxEntry move(String fromPath, String toPath) throws DbxException
null
.DbxException
public <T> T doPost(String host, String path, String[] params, ArrayList<HttpRequestor.Header> headers, DbxRequestUtil.ResponseHandler<T> handler) throws DbxException
DbxException
Copyright © 2014. All rights reserved.