public abstract class AbstractFileHandler extends BaseFileHandler
adds capability to use a FileModel. Most of the time you should extend from this class unless it's absolutely necessary that you implement the interface for some purpose.
A note on firing events: There are a few events that can be fired. Usually, the file info changed events are fired before the transfer even begins. The file transfer starting and finished events should be fired right before and after a file transfer. Any transfer status in between should be fired with filesize changed events. The events are left up to you to decide when to fire.
Here's a suggested of using the event firing. When receiving file info, fire fireFileInfoChanged. Right before file transfer started, fire fireFileTransferStarting. If a listener vetoes the transfer, then a fileTransferFinished(cancel status) will be fired automatically. During transfer, fireFileInfoChanged and fireFilesizeChanged can be used. When transfer is finished, fire fileTransferFinished(finished status). If socket is prematurely closed or errors occurred while transferring or handshaking, then fire fileTransferFinished(error status).
| Modifier and Type | Field and Description |
|---|---|
protected FileModel |
model |
listenerList| Constructor and Description |
|---|
AbstractFileHandler(FileModel model)
by default with no throttling
|
| Modifier and Type | Method and Description |
|---|---|
FileModel |
getModel() |
TransferRateThrottler |
getTransferRateThrottler() |
void |
setModel(FileModel model)
sets the file model for this file transfer.
|
void |
setTransferRateThrottler(TransferRateThrottler throttler)
sets the transfer rate throttler.
|
addFileListener, fireFileInfoChanged, fireFilesizeChanged, fireFileTransferFinished, fireFileTransferStarting, fireFileTransferStartingWithoutVeto, removeFileListenerclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithandle, shutdown, startprotected FileModel model
public AbstractFileHandler(FileModel model)
model - the file model associated with the file transferpublic FileModel getModel()
public void setModel(FileModel model)
public TransferRateThrottler getTransferRateThrottler()
public void setTransferRateThrottler(TransferRateThrottler throttler)
Copyright © 2001-2005 Echomine. All Rights Reserved.