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.UncaughtExceptionHandler
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
UPLOAD_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, yield
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
interrupt, isAlive, join, start
public FileUploadManagerThreadImpl(UploadPolicy uploadPolicy) throws JUploadException
uploadPolicy
- JUploadException
public final void run()
FileUploadManagerThread
run
in interface Runnable
run
in interface FileUploadManagerThread
run
in class Thread
FileUploadManagerThread.run()
public void setUploadException(JUploadException uploadExceptionParam)
FileUploadManagerThread
setUploadException
in interface FileUploadManagerThread
FileUploadManagerThread.setUploadException(wjhk.jupload2.exception.JUploadException)
public JUploadException getUploadException()
FileUploadManagerThread
getUploadException
in interface FileUploadManagerThread
FileUploadManagerThread.getUploadException()
public boolean isUploadFinished()
FileUploadManagerThread
FileUploadManagerThread.run()
method.isUploadFinished
in interface FileUploadManagerThread
FileUploadManagerThread.isUploadFinished()
public boolean isUploadStopped()
FileUploadManagerThread
FileUploadManagerThread.isUploadFinished()
isUploadStopped
in interface FileUploadManagerThread
FileUploadManagerThread.isUploadStopped()
public void nbBytesUploaded(long nbBytes, UploadFileData uploadFileData) throws JUploadException
FileUploadManagerThread
nbBytesUploaded
in interface FileUploadManagerThread
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
FileUploadManagerThread.nbBytesUploaded(long, UploadFileData)
public void setUploadStatus(UploadFilePacket uploadFilePacket, UploadFileData uploadFileData, int uploadStatus) throws JUploadException
FileUploadManagerThread
setUploadStatus
in interface FileUploadManagerThread
uploadFilePacket
- The current packet. This parameter is mandatory only for theuploadFileData
- The file whose upload begins, is going on or is finished.JUploadException
FileUploadManagerThread.setUploadStatus(wjhk.jupload2.upload.UploadFilePacket,
wjhk.jupload2.upload.UploadFileData, int)
public void stopUpload()
FileUploadManagerThread
stopUpload
in interface FileUploadManagerThread
FileUploadManagerThread.stopUpload()
public void anotherFileHasBeenSent(UploadFilePacket uploadFilePacket, UploadFileData newlyUploadedFileData) throws JUploadException
FileUploadManagerThread
anotherFileHasBeenSent
in interface FileUploadManagerThread
JUploadException
FileUploadManagerThread.anotherFileHasBeenSent(wjhk.jupload2.upload.UploadFilePacket,
wjhk.jupload2.upload.UploadFileData)
public void currentRequestIsFinished(UploadFilePacket uploadFilePacket) throws JUploadException
FileUploadManagerThread
currentRequestIsFinished
in interface FileUploadManagerThread
uploadFilePacket
- The packet of files that was successfully uploaded.JUploadException
FileUploadManagerThread.currentRequestIsFinished(wjhk.jupload2.upload.UploadFilePacket)
Copyright © 2015. All rights reserved.