Package com.dropbox.core.v2
Class DbxUploadStyleBuilder<R,E,X extends DbxApiException>
- java.lang.Object
-
- com.dropbox.core.v2.DbxUploadStyleBuilder<R,E,X>
-
- Type Parameters:
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)
- Direct Known Subclasses:
AlphaUploadBuilder,UploadBuilder,UploadSessionAppendV2Builder,UploadSessionStartBuilder
public abstract class DbxUploadStyleBuilder<R,E,X extends DbxApiException> extends java.lang.ObjectThe common interface for all builders associated with upload style methods. After setting any optional request parameters, usestart()oruploadAndFinish(java.io.InputStream)to initiate the request. Example usage:
Same example using the// 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(); }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 Summary
Constructors Constructor Description DbxUploadStyleBuilder()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract DbxUploader<R,E,X>start()Begins the upload request using this builder's request parameters and returns aDbxUploaderfor writing the request body.RuploadAndFinish(java.io.InputStream in)Convenience method forDbxUploader.uploadAndFinish(InputStream):RuploadAndFinish(java.io.InputStream in, long limit)Convenience method forDbxUploader.uploadAndFinish(InputStream, long):RuploadAndFinish(java.io.InputStream in, long limit, IOUtil.ProgressListener progressListener)Convenience method forDbxUploader.uploadAndFinish(InputStream, long, IOUtil.ProgressListener):RuploadAndFinish(java.io.InputStream in, IOUtil.ProgressListener progressListener)Convenience method forDbxUploader.uploadAndFinish(InputStream, IOUtil.ProgressListener):
-
-
-
Method Detail
-
start
public abstract DbxUploader<R,E,X> start() throws DbxException
Begins the upload request using this builder's request parameters and returns aDbxUploaderfor writing the request body. Callers can complete the request by writing the upload data to theOutputStreamreturned byDbxUploader.getOutputStream()and receiving the server response usingDbxUploader.finish(). SeeuploadAndFinish(java.io.InputStream)convenience method for a simpler way to complete the request.- Returns:
DbxUploaderused to upload data and complete the request- Throws:
DbxException- if an error occursing initializing the request
-
uploadAndFinish
public R uploadAndFinish(java.io.InputStream in) throws X extends DbxApiException, DbxException, java.io.IOException
Convenience method forDbxUploader.uploadAndFinish(InputStream):builder.start().uploadAndFinish(in);- Parameters:
in-InputStreamcontaining data to upload- Returns:
- Response from server
- Throws:
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
-
uploadAndFinish
public R uploadAndFinish(java.io.InputStream in, long limit) throws X extends DbxApiException, DbxException, java.io.IOException
Convenience method forDbxUploader.uploadAndFinish(InputStream, long):builder.start().uploadAndFinish(in, limit);- Parameters:
in-InputStreamcontaining data to uploadlimit- Maximum number of bytes to read from the givenInputStream- Returns:
- Response from server
- Throws:
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
-
uploadAndFinish
public R uploadAndFinish(java.io.InputStream in, long limit, IOUtil.ProgressListener progressListener) throws X extends DbxApiException, DbxException, java.io.IOException
Convenience method forDbxUploader.uploadAndFinish(InputStream, long, IOUtil.ProgressListener):builder.start().uploadAndFinish(in, limit, progressListener);- Parameters:
in-InputStreamcontaining data to uploadlimit- Maximum number of bytes to read from the givenInputStreamprogressListener-ProgressListenerto track the upload progress. Only support OKHttpRequester and StandardHttpRequester- Returns:
- Response from server
- Throws:
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
-
uploadAndFinish
public R uploadAndFinish(java.io.InputStream in, IOUtil.ProgressListener progressListener) throws X extends DbxApiException, DbxException, java.io.IOException
Convenience method forDbxUploader.uploadAndFinish(InputStream, IOUtil.ProgressListener):builder.start().uploadAndFinish(in, progressListener);- Parameters:
in-InputStreamcontaining data to uploadprogressListener-ProgressListenerto track the upload progress. Only support OKHttpRequester and StandardHttpRequester- Returns:
- Response from server
- Throws:
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
-
-