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 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(InputStream in)
Convenience method for
DbxUploader.uploadAndFinish(InputStream) : |
R |
uploadAndFinish(InputStream in,
long limit)
Convenience method for
DbxUploader.uploadAndFinish(InputStream, long) : |
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(InputStream in) throws X extends DbxApiException, DbxException, 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 responseIOException
- if an error occurs reading the input stream.X extends DbxApiException
public R uploadAndFinish(InputStream in, long limit) throws X extends DbxApiException, DbxException, 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 responseIOException
- if an error occurs reading the input stream.X extends DbxApiException