public class ResumableHttpFileUploader
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ResumableHttpFileUploader.Builder
Builder class for constructing
ResumableHttpFileUploader instances. |
static class |
ResumableHttpFileUploader.RequestMethod
Http request type to use in upload requests.
|
static class |
ResumableHttpFileUploader.ResponseMessage
The response message returned by the upload task when it has finished
uploading the last chunk.
|
static class |
ResumableHttpFileUploader.UploadState
Upload state associated with this file uploader.
|
| Modifier and Type | Field and Description |
|---|---|
static long |
DEFAULT_MAX_CHUNK_SIZE
Default maximum number of bytes that will be uploaded to the server in any
single HTTP request (set to 10 MB).
|
static long |
DEFAULT_PROGRESS_INTERVAL_MS
Default number of milliseconds for the progress notification interval.
|
static java.lang.String |
METHOD_OVERRIDE
Method-override http header.
|
| Constructor and Description |
|---|
ResumableHttpFileUploader(java.net.URL url,
java.io.File file,
java.util.concurrent.ExecutorService executor,
ProgressListener progressListener,
long progressIntervalMillis)
Deprecated.
Please use
ResumableHttpFileUploader.Builder |
ResumableHttpFileUploader(java.net.URL url,
java.io.File file,
java.util.concurrent.ExecutorService executor,
ProgressListener progressListener,
long chunkSize,
long progressIntervalMillis)
Deprecated.
Please use
ResumableHttpFileUploader.Builder |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
addHeader(java.lang.String key,
java.lang.String value)
Add a http header to send in each of the upload requests.
|
UploadData |
getData()
Gets the file associated with this uploader.
|
ResumableHttpFileUploader.RequestMethod |
getHttpRequestMethod()
Returns the http request method to use for upload.
|
long |
getNumBytesUploaded()
Gets the total number of bytes uploaded by this uploader.
|
double |
getProgress()
Gets the upload progress denoting the percentage of bytes that have been
uploaded, represented between 0.0 (0%) and and 1.0 (100%).
|
ResumableHttpFileUploader.ResponseMessage |
getResponse()
Gets the response from the server if it is available.
|
ResumableHttpFileUploader.UploadState |
getUploadState()
Gets the current upload state of the uploader.
|
boolean |
isDone()
Identifies if the upload task has completed
|
boolean |
isPaused()
Identifies if the uploader is paused
|
void |
pause()
Causes the uploader to pause uploading.
|
void |
resume()
Resumes an upload if it is currently paused, or if it has not yet started.
|
void |
setHttpRequestMethod(ResumableHttpFileUploader.RequestMethod requestMethod)
Deprecated.
Please use
ResumableHttpFileUploader.Builder#setRequestMethod(RequestMethod) |
java.util.concurrent.Future<ResumableHttpFileUploader.ResponseMessage> |
start()
Starts an upload beginning with the first byte in the file.
|
public static long DEFAULT_MAX_CHUNK_SIZE
public static final long DEFAULT_PROGRESS_INTERVAL_MS
public static final java.lang.String METHOD_OVERRIDE
@Deprecated
public ResumableHttpFileUploader(java.net.URL url,
java.io.File file,
java.util.concurrent.ExecutorService executor,
ProgressListener progressListener,
long progressIntervalMillis)
throws java.io.IOException
ResumableHttpFileUploader.Builderurl - which locates the destination of the upload requestfile - containing bytes to send to the serverexecutor - service to execute asynchronous upload tasks withprogressListener - for receiving progress notificationsprogressIntervalMillis - number of milliseconds between
progress listener notificationsjava.io.IOException - if the file is not readable or does not exist@Deprecated
public ResumableHttpFileUploader(java.net.URL url,
java.io.File file,
java.util.concurrent.ExecutorService executor,
ProgressListener progressListener,
long chunkSize,
long progressIntervalMillis)
throws java.io.IOException
ResumableHttpFileUploader.Builderurl - which locates the destination of the upload requestfile - containing bytes to send to the serverexecutor - service to execute asynchronous upload tasks withprogressListener - for receiving progress notificationschunkSize - size of the chunks that will get uploaded by individual
HTTP requestsprogressIntervalMillis - number of milliseconds between
progress listener notificationsjava.io.IOException - if the file is not readable or does not exist@Deprecated public void setHttpRequestMethod(ResumableHttpFileUploader.RequestMethod requestMethod)
ResumableHttpFileUploader.Builder#setRequestMethod(RequestMethod)requestMethod - http request typepublic ResumableHttpFileUploader.RequestMethod getHttpRequestMethod()
public java.lang.String addHeader(java.lang.String key,
java.lang.String value)
key - http header namevalue - http header valuepublic long getNumBytesUploaded()
public double getProgress()
public ResumableHttpFileUploader.ResponseMessage getResponse()
null is returned.public ResumableHttpFileUploader.UploadState getUploadState()
public boolean isPaused()
true if the uploader is pausedpublic void pause()
resume(). This method does not block.public void resume()
public java.util.concurrent.Future<ResumableHttpFileUploader.ResponseMessage> start()
public boolean isDone()
true if the uploader is donepublic UploadData getData()