public class BoxFileDownload
extends java.lang.Object
IFileTransferListener
to monitor downloading progress.Constructor and Description |
---|
BoxFileDownload(IBoxConfig config,
IBoxRESTClient restClient,
java.lang.String fileId)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
execute(IBoxRequestAuth auth,
java.io.File destination,
IBoxJSONParser parser,
BoxDefaultRequestObject requestObject)
Execute a download.
|
java.io.InputStream |
execute(IBoxRequestAuth auth,
IBoxJSONParser parser,
BoxDefaultRequestObject requestObject)
Execute the download and return the raw InputStream.
|
void |
execute(IBoxRequestAuth auth,
java.io.OutputStream[] outputStreams,
IBoxJSONParser parser,
BoxDefaultRequestObject requestObject)
Execute a download.
|
long |
getBytesTransferred()
Get bytes transferred.
|
void |
setProgressListener(IFileTransferListener listener)
Set the listener listening to download progress.
|
void |
setProgressUpdateInterval(int time)
Set the interval time you want the progress update to be reported.
|
public BoxFileDownload(IBoxConfig config, IBoxRESTClient restClient, java.lang.String fileId)
config
- configrestClient
- REST client to make api calls.fileId
- Id of the file to be downloaded.public void setProgressListener(IFileTransferListener listener)
listener
- listenerpublic void setProgressUpdateInterval(int time)
time
- interval timepublic void execute(IBoxRequestAuth auth, java.io.OutputStream[] outputStreams, IBoxJSONParser parser, BoxDefaultRequestObject requestObject) throws BoxRestException, java.io.IOException, BoxServerException, java.lang.InterruptedException, AuthFatalFailureException
auth
- authoutputStreams
- OutputStream's the file is going to be downloaded into.parser
- json parserrequestObject
- request objectBoxRestException
- exceptionjava.io.IOException
- exceptionBoxServerException
- exceptionjava.lang.InterruptedException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic void execute(IBoxRequestAuth auth, java.io.File destination, IBoxJSONParser parser, BoxDefaultRequestObject requestObject) throws BoxRestException, java.io.IOException, BoxServerException, java.lang.InterruptedException, AuthFatalFailureException
auth
- authdestination
- destination fileparser
- json parser
- requestObject
- request objectBoxRestException
- exceptionjava.io.IOException
- exceptionBoxServerException
- exceptionjava.lang.InterruptedException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic java.io.InputStream execute(IBoxRequestAuth auth, IBoxJSONParser parser, BoxDefaultRequestObject requestObject) throws BoxRestException, BoxServerException, AuthFatalFailureException
auth
- authparser
- json parserrequestObject
- request objectBoxRestException
- exceptionBoxServerException
- exceptionAuthFatalFailureException
- exception indicating authentication totally failedpublic long getBytesTransferred()