public class FileUploadManagerThreadImpl extends Thread implements FileUploadManagerThread
JUploadPanel.updateButtonState() is called, to refresh the button state. Its job is to: FileData#beforeUpload() for each file in the file list. JUploadPanel.updateButtonState() and the call to
UploadPolicy.afterUpload(Exception, String). JUploadPanel, when the user clicks on the upload button.Thread.State, Thread.UncaughtExceptionHandlerMAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITYUPLOAD_STATUS_CHUNK_UPLOADED_WAITING_FOR_RESPONSE, UPLOAD_STATUS_FILE_UPLOADED_WAITING_FOR_RESPONSE, UPLOAD_STATUS_NOT_STARTED, UPLOAD_STATUS_UPLOADED, UPLOAD_STATUS_UPLOADING| Constructor and Description |
|---|
FileUploadManagerThreadImpl(UploadPolicy uploadPolicy)
Standard constructor of the class.
|
| 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 uploadFilePacket)
This method is called when the server response for the upload indicates a
success.
|
JUploadException |
getUploadException()
Get the last upload exception that occurs.
|
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 |
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 uploadExceptionParam)
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 |
stopUpload()
Reaction to the user click on the 'Stop' button, or any action from the
user asking to stop the upload.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitinterrupt, isAlive, join, startpublic FileUploadManagerThreadImpl(UploadPolicy uploadPolicy) throws JUploadException
uploadPolicy - JUploadExceptionpublic final void run()
FileUploadManagerThreadrun in interface Runnablerun in interface FileUploadManagerThreadrun in class ThreadFileUploadManagerThread.run()public void setUploadException(JUploadException uploadExceptionParam)
FileUploadManagerThreadsetUploadException in interface FileUploadManagerThreadFileUploadManagerThread.setUploadException(wjhk.jupload2.exception.JUploadException)public JUploadException getUploadException()
FileUploadManagerThreadgetUploadException in interface FileUploadManagerThreadFileUploadManagerThread.getUploadException()public boolean isUploadFinished()
FileUploadManagerThreadFileUploadManagerThread.run() method.isUploadFinished in interface FileUploadManagerThreadFileUploadManagerThread.isUploadFinished()public boolean isUploadStopped()
FileUploadManagerThreadFileUploadManagerThread.isUploadFinished()isUploadStopped in interface FileUploadManagerThreadFileUploadManagerThread.isUploadStopped()public void nbBytesUploaded(long nbBytes,
UploadFileData uploadFileData)
throws JUploadException
FileUploadManagerThreadnbBytesUploaded in interface FileUploadManagerThreadnbBytes - Number of additional bytes that where uploaded.uploadFileData - The file that is currently being uploade (or null if no file
is being uploaded)JUploadExceptionFileUploadManagerThread.nbBytesUploaded(long, UploadFileData)public void setUploadStatus(UploadFilePacket uploadFilePacket, UploadFileData uploadFileData, int uploadStatus) throws JUploadException
FileUploadManagerThreadsetUploadStatus in interface FileUploadManagerThreaduploadFilePacket - The current packet. This parameter is mandatory only for theuploadFileData - The file whose upload begins, is going on or is finished.JUploadExceptionFileUploadManagerThread.setUploadStatus(wjhk.jupload2.upload.UploadFilePacket,
wjhk.jupload2.upload.UploadFileData, int)public void stopUpload()
FileUploadManagerThreadstopUpload in interface FileUploadManagerThreadFileUploadManagerThread.stopUpload()public void anotherFileHasBeenSent(UploadFilePacket uploadFilePacket, UploadFileData newlyUploadedFileData) throws JUploadException
FileUploadManagerThreadanotherFileHasBeenSent in interface FileUploadManagerThreadJUploadExceptionFileUploadManagerThread.anotherFileHasBeenSent(wjhk.jupload2.upload.UploadFilePacket,
wjhk.jupload2.upload.UploadFileData)public void currentRequestIsFinished(UploadFilePacket uploadFilePacket) throws JUploadException
FileUploadManagerThreadcurrentRequestIsFinished in interface FileUploadManagerThreaduploadFilePacket - The packet of files that was successfully uploaded.JUploadExceptionFileUploadManagerThread.currentRequestIsFinished(wjhk.jupload2.upload.UploadFilePacket)Copyright © 2015. All rights reserved.