It
can be very useful to be able to monitor file transfers, that is, to
receive programmatic feedback on how the transfer is progressing.
Similarly, it can be useful to obtain the commands that are being sent
back and forth.
The
EventListener
interface is used for this purpose. Typically, the developer
implements this interface in their own class (perhaps as an anonymous
class). An instance is set via setEventListener(),
and once the transfer begins, the instance is notified of the start and end of the transfer, as well as periodically
during the transfer of how many bytes have been transferred so far. The commands sent back and forth to the server are also available.
The frequency of notifications of bytes transferred is controlled in the AdvancedGeneralSettings,
via setTransferNotifyInterval(), which takes the number of bytes in between callbacks.
Note that this value must be greater than
the transfer buffer size, which can be changed via setTransferBufferSize().
This is because for efficiency, checks for the notification interval are only performed after each buffer has been transferred.