*
* // Begin, this class implements the FtpObserver interface
* class Sample implements FtpObserver
* {
*
* // Skip constructors and many things for simple
*
* public void download()
* {
* try
* {
* // Pass this object which implements FtpObserver interface to the method
* ftpbean.getBinaryFile("remotefile", "localfile", this);
* } catch(Exception e)
* {
* System.out.println("Exception!!!");
* }
* }
*
* public void byteRead(int bytes)
* {
* System.out.println(bytes + " new bytes are read.");
* }
*
* public void byteWrite(int bytes)
* {
* System.out.println(bytes + " new bytes are written to server.");
* }
* }
*
*
*
*/
public interface FtpObserver
{
/**
* This method is called every time new bytes are read in downloading process.
* @param bytes The number of new bytes read from the server.
* @return true if the process should continue reading, false indicates cancel and the process should stop
*/
boolean byteRead(int bytes);
/**
* This method is called every time new bytes is written to the ftp server in uploading process.
* @param bytes The number of new bytes write to the server.
*/
boolean byteWrite(int bytes);
}