com.echomine.net
Class AbstractFileHandler
java.lang.Object
com.echomine.net.BaseFileHandler
com.echomine.net.AbstractFileHandler
- All Implemented Interfaces:
- FileHandler, SocketHandler
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).
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
model
protected FileModel model
AbstractFileHandler
public AbstractFileHandler(FileModel model)
- by default with no throttling
- Parameters:
model
- the file model associated with the file transfer
getModel
public FileModel getModel()
- Returns:
- the file model associated with this file transfer
setModel
public void setModel(FileModel model)
- sets the file model for this file transfer. It is recommended that you
do not set the file model after the file transfer has begun
getTransferRateThrottler
public TransferRateThrottler getTransferRateThrottler()
- Returns:
- the transfer rate throttler
setTransferRateThrottler
public void setTransferRateThrottler(TransferRateThrottler throttler)
- sets the transfer rate throttler. You can safely change the throttler
in the middle of the file transfer to utilize a new throttler.
Copyright © 2001-2005 Echomine. All Rights Reserved.