public interface FileUploadManagerThread
Modifier and Type | Field and Description |
---|---|
static int |
UPLOAD_STATUS_CHUNK_UPLOADED_WAITING_FOR_RESPONSE
A chunk (a part) of the file identified by numOfFileInCurrentUpload has
been sent.
|
static int |
UPLOAD_STATUS_FILE_UPLOADED_WAITING_FOR_RESPONSE
All data for the file identified by numOfFileInCurrentUpload has been
sent.
|
static int |
UPLOAD_STATUS_NOT_STARTED
Indicates that nothings has begun
|
static int |
UPLOAD_STATUS_UPLOADED
The upload for the file identified by numOfFileInCurrentUpload is
finished
|
static int |
UPLOAD_STATUS_UPLOADING
We're sending data to the server, for the file identified by
numOfFileInCurrentUpload.
|
Modifier and Type | Method and Description |
---|---|
void |
anotherFileHasBeenSent(UploadFilePacket uploadFilePacket,
UploadFileData newlyUploadedFileData)
This method is called each time a new file is sent to the server.
|
void |
currentRequestIsFinished(UploadFilePacket packet)
This method is called when the server response for the upload indicates a
success.
|
JUploadException |
getUploadException()
Get the last upload exception that occurs.
|
void |
interrupt()
Check if the thread is running...
|
boolean |
isAlive()
Check if the thread is running...
|
boolean |
isUploadFinished()
Indicates whether the upload is finished or not.
|
boolean |
isUploadStopped()
Indicates if the upload has been stopped by the user, or by any upload
error.
|
void |
join()
The heart of the program.
|
void |
nbBytesUploaded(long nbBytes,
UploadFileData uploadFileData)
Used by the UploadFileData#uploadFile(java.io.OutputStream, long) for
each uploaded buffer
|
void |
run()
The heart of the program.
|
void |
setUploadException(JUploadException uploadException)
Stores the last upload exception that occurs.
|
void |
setUploadStatus(UploadFilePacket uploadFilePacket,
UploadFileData uploadFileData,
int uploadStatus)
Indicate the current state of the upload, to allow a correct display of
UPLOAD_STATUS_UPLOADED status. the upload progress bar.
|
void |
start()
The heart of the program.
|
void |
stopUpload()
Reaction to the user click on the 'Stop' button, or any action from the
user asking to stop the upload.
|
static final int UPLOAD_STATUS_NOT_STARTED
static final int UPLOAD_STATUS_UPLOADING
static final int UPLOAD_STATUS_CHUNK_UPLOADED_WAITING_FOR_RESPONSE
static final int UPLOAD_STATUS_FILE_UPLOADED_WAITING_FOR_RESPONSE
static final int UPLOAD_STATUS_UPLOADED
void join() throws InterruptedException
InterruptedException
Thread.join()
void run()
Thread.run()
void start()
Thread.start()
void interrupt()
Thread.interrupt()
boolean isAlive()
Thread.isAlive()
void setUploadException(JUploadException uploadException)
uploadException
- JUploadException getUploadException()
boolean isUploadFinished()
run()
method.boolean isUploadStopped()
isUploadFinished()
void nbBytesUploaded(long nbBytes, UploadFileData uploadFileData) throws JUploadException
nbBytes
- Number of additional bytes that where uploaded.uploadFileData
- The file that is currently being uploade (or null if no file
is being uploaded)JUploadException
void setUploadStatus(UploadFilePacket uploadFilePacket, UploadFileData uploadFileData, int uploadStatus) throws JUploadException
uploadFilePacket
- The current packet. This parameter is mandatory only for theuploadFileData
- The file whose upload begins, is going on or is finished.uploadStatus
- JUploadException
void stopUpload()
void anotherFileHasBeenSent(UploadFilePacket uploadFilePacket, UploadFileData newlyUploadedFileData) throws JUploadException
uploadFilePacket
- newlyUploadedFileData
- JUploadException
void currentRequestIsFinished(UploadFilePacket packet) throws JUploadException
packet
- The packet of files that was successfully uploaded.JUploadException
Copyright © 2015. All rights reserved.