R
- response type returned by server on request successE
- error type returned by server on request failureX
- exception type thrown by server on request failure (wraps error type)public abstract class DbxUploadStyleBuilder<R,E,X extends DbxApiException>
extends java.lang.Object
start()
or uploadAndFinish(java.io.InputStream)
to initiate the
request.
Example usage:
// set our optional request parameters
UploadUploader uploader = client.files.uploadBuilder("/test.txt")
.autorename(true)
.mute(true)
.clientModified(new Date())
.start();
byte [] data = // ... your data here
try {
// set our upload content
OutputStream out = uploader.getOutputStream();
out.write(data);
// complete request and get server response
response = uploader.finish();
} finally {
uploader.close();
}
Same example using the uploadAndFinish(java.io.InputStream)
convenience method:
FileInputStream in = new FileInputStream(file);
try {
// set our optional request parameters
response = client.files.uploadBuilder("/test.txt")
.autorename(true)
.mute(true)
.clientModified(new Date())
.uploadAndFinish(in);
} finally {
in.close();
}
Constructor and Description |
---|
DbxUploadStyleBuilder() |
Modifier and Type | Method and Description |
---|---|
abstract DbxUploader<R,E,X> |
start()
Begins the upload request using this builder's request parameters and returns a
DbxUploader for writing the request body. |
R |
uploadAndFinish(java.io.InputStream in)
Convenience method for
DbxUploader.uploadAndFinish(InputStream) : |
R |
uploadAndFinish(java.io.InputStream in,
IOUtil.ProgressListener progressListener)
Convenience method for
DbxUploader.uploadAndFinish(InputStream, IOUtil.ProgressListener) : |
R |
uploadAndFinish(java.io.InputStream in,
long limit)
Convenience method for
DbxUploader.uploadAndFinish(InputStream, long) : |
R |
uploadAndFinish(java.io.InputStream in,
long limit,
IOUtil.ProgressListener progressListener)
Convenience method for
DbxUploader.uploadAndFinish(InputStream, long, IOUtil.ProgressListener) : |
public abstract DbxUploader<R,E,X> start() throws DbxException
DbxUploader
for writing the request body.
Callers can complete the request by writing the upload data to the OutputStream
returned by DbxUploader.getOutputStream()
and receiving the server response using
DbxUploader.finish()
.
See uploadAndFinish(java.io.InputStream)
convenience method for a simpler way to complete the request.DbxUploader
used to upload data and complete the requestDbxException
- if an error occursing initializing the requestpublic R uploadAndFinish(java.io.InputStream in) throws X extends DbxApiException, DbxException, java.io.IOException
DbxUploader.uploadAndFinish(InputStream)
:
builder.start().uploadAndFinish(in);
in
- InputStream
containing data to uploadX
- if the server sent an error response for the requestDbxException
- if an error occurs uploading the data or reading the responsejava.io.IOException
- if an error occurs reading the input stream.X extends DbxApiException
public R uploadAndFinish(java.io.InputStream in, long limit) throws X extends DbxApiException, DbxException, java.io.IOException
DbxUploader.uploadAndFinish(InputStream, long)
:
builder.start().uploadAndFinish(in, limit);
in
- InputStream
containing data to uploadlimit
- Maximum number of bytes to read from the given InputStream
X
- if the server sent an error response for the requestDbxException
- if an error occurs uploading the data or reading the responsejava.io.IOException
- if an error occurs reading the input stream.X extends DbxApiException
public R uploadAndFinish(java.io.InputStream in, long limit, IOUtil.ProgressListener progressListener) throws X extends DbxApiException, DbxException, java.io.IOException
DbxUploader.uploadAndFinish(InputStream, long, IOUtil.ProgressListener)
:
builder.start().uploadAndFinish(in, limit, progressListener);
in
- InputStream
containing data to uploadlimit
- Maximum number of bytes to read from the given InputStream
progressListener
- ProgressListener
to track the upload progress. Only support
OKHttpRequester and StandardHttpRequesterX
- if the server sent an error response for the requestDbxException
- if an error occurs uploading the data or reading the responsejava.io.IOException
- if an error occurs reading the input stream.X extends DbxApiException
public R uploadAndFinish(java.io.InputStream in, IOUtil.ProgressListener progressListener) throws X extends DbxApiException, DbxException, java.io.IOException
DbxUploader.uploadAndFinish(InputStream, IOUtil.ProgressListener)
:
builder.start().uploadAndFinish(in, progressListener);
in
- InputStream
containing data to uploadprogressListener
- ProgressListener
to track the upload progress. Only support
OKHttpRequester and StandardHttpRequesterX
- if the server sent an error response for the requestDbxException
- if an error occurs uploading the data or reading the responsejava.io.IOException
- if an error occurs reading the input stream.X extends DbxApiException