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.Methods| Modifier and Type | Field and Description |
|---|---|
protected DownloadStartListener |
mDownloadStartListener |
protected java.io.OutputStream |
mFileOutputStream |
protected java.lang.String |
mId |
protected long |
mRangeEnd |
protected long |
mRangeStart |
protected java.io.File |
mTarget |
JSON_OBJECT, mBodyMap, mContentType, mHeaderMap, mListener, mQueryMap, mRequestMethod, mRequestUrlString, mRequiresSocket, mSession, mTimeout| Constructor and Description |
|---|
BoxRequestDownload(java.lang.Class<E> clazz,
java.io.File target,
java.lang.String requestUrl,
BoxSession session)
Deprecated.
Please use the BoxRequestDownload constructor that takes in an id as this method may be removed in future releases
|
BoxRequestDownload(java.lang.Class<E> clazz,
java.io.OutputStream outputStream,
java.lang.String requestUrl,
BoxSession session)
Deprecated.
Please use the BoxRequestDownload constructor that takes in an id as this method may be removed in future releases
|
BoxRequestDownload(java.lang.String id,
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.String id,
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 |
|---|---|
java.lang.String |
getId()
Returns the id of the Box item being modified.
|
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) |
void |
setContentAccess(boolean contentAccess)
Method to set whether this download is a just for content access or a preview.
|
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, createHeaderMap, createHttpRequest, createQuery, equals, getIfMatchEtag, getIfNoneMatchEtag, getRequestHandler, getSession, getSocket, getStringBody, handleSendForCachedResult, handleToTaskForCachedResult, handleUpdateCache, hashCode, importRequestContentMapsFrom, logRequest, onSend, onSendCompleted, parseHashMapEntry, parseJsonObject, send, sendRequest, setBody, setContentType, setIfMatchEtag, setIfNoneMatchEtag, setRequestHandler, setTimeOut, toTaskprotected long mRangeStart
protected long mRangeEnd
protected java.io.OutputStream mFileOutputStream
protected java.io.File mTarget
protected DownloadStartListener mDownloadStartListener
protected java.lang.String mId
public BoxRequestDownload(java.lang.String id,
java.lang.Class<E> clazz,
java.io.OutputStream outputStream,
java.lang.String requestUrl,
BoxSession session)
id - id of the item to downloadclazz - 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.@Deprecated public 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.String id,
java.lang.Class<E> clazz,
java.io.File target,
java.lang.String requestUrl,
BoxSession session)
id - box file id to download.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.@Deprecated 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.public java.lang.String getId()
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.public void setContentAccess(boolean contentAccess)
contentAccess - true in case this download is only for content access, and not preview