E - type of BoxObject returned in the response.R - type of BoxRequest being created.public abstract class BoxRequestDownload<E extends BoxObject,R extends BoxRequest<E,R>> extends BoxRequest<E,R>
| Modifier and Type | Class and Description |
|---|---|
static class |
BoxRequestDownload.DownloadRequestHandler
A request handler that is designed to handle the parsing logic necessary for a BoxRequestDownload.
|
BoxRequest.BoxRequestHandler<R extends BoxRequest>, BoxRequest.ContentTypes, BoxRequest.MethodsJSON_OBJECT, mBodyMap, mContentType, mHeaderMap, mListener, mQueryMap, mRequestMethod, mRequestUrlString, mSession| Constructor and Description |
|---|
BoxRequestDownload(java.lang.Class<E> clazz,
java.io.File target,
java.lang.String requestUrl,
BoxSession session)
Creates a download request to a file with the default parameters.
|
BoxRequestDownload(java.lang.Class<E> clazz,
java.io.OutputStream outputStream,
java.lang.String requestUrl,
BoxSession session)
Creates a download request to an output stream with the default parameters.
|
| Modifier and Type | Method and Description |
|---|---|
long |
getRangeEnd()
Returns the end range for the download.
|
long |
getRangeStart()
Returns the start range for the download.
|
java.io.File |
getTarget()
Returns the target file for the download.
|
java.io.OutputStream |
getTargetStream()
Returns the target output stream for the download.
|
java.lang.String |
getVersion()
If set in this request, the version id of an item to be downloaded.
|
protected void |
logDebug(BoxHttpResponse response) |
R |
setDownloadStartListener(DownloadStartListener listener)
Sets the download start listener for the request.
|
protected void |
setHeaders(com.box.androidsdk.content.requests.BoxHttpRequest request) |
R |
setProgressListener(ProgressListener listener)
Sets the progress listener for the download request.
|
R |
setRange(long rangeStart,
long rangeEnd)
The portion of a file to download.
|
R |
setVersion(java.lang.String versionId)
Sets the version of the file to download.
|
buildUrl, createHttpRequest, createQuery, getIfMatchEtag, getIfNoneMatchEtag, getRequestHandler, getSession, getStringBody, importRequestContentMapsFrom, logRequest, parseHashMapEntry, parseJsonObject, send, setBody, setContentType, setIfMatchEtag, setIfNoneMatchEtag, setRequestHandler, setTimeOut, toTaskpublic BoxRequestDownload(java.lang.Class<E> clazz, java.io.OutputStream outputStream, java.lang.String requestUrl, BoxSession session)
clazz - class of the object returned in the response.outputStream - output stream to download the file to.requestUrl - URL of the download endpoint.session - the authenticated session that will be used to make the request with.public BoxRequestDownload(java.lang.Class<E> clazz, java.io.File target, java.lang.String requestUrl, BoxSession session)
clazz - class of the object returned in the response.target - target file to download the file to.requestUrl - URL of the download endpoint.session - the authenticated session that will be used to make the request with.protected void setHeaders(com.box.androidsdk.content.requests.BoxHttpRequest request)
setHeaders in class BoxRequest<E extends BoxObject,R extends BoxRequest<E,R>>protected void logDebug(BoxHttpResponse response) throws BoxException
logDebug in class BoxRequest<E extends BoxObject,R extends BoxRequest<E,R>>BoxExceptionpublic java.io.File getTarget()
public java.io.OutputStream getTargetStream()
public long getRangeStart()
public long getRangeEnd()
public R setRange(long rangeStart, long rangeEnd)
rangeStart - value in bytes from which to begin downloading an item.rangeEnd - value in bytes to end downloading an item.public R setVersion(java.lang.String versionId)
versionId - the version id of an item if a previous version(see file_version field for file) is desired instead of the current.public java.lang.String getVersion()
public R setProgressListener(ProgressListener listener)
listener - progress listener for the download.public R setDownloadStartListener(DownloadStartListener listener)
listener - an optional listener for knowing when the download for this request has started.