public interface FtpObserver
// 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.");
}
}
| Modifier and Type | Method and Description |
|---|---|
boolean |
byteRead(int bytes)
This method is called every time new bytes are read in downloading process.
|
boolean |
byteWrite(int bytes)
This method is called every time new bytes is written to the ftp server in uploading process.
|
boolean byteRead(int bytes)
bytes - The number of new bytes read from the server.boolean byteWrite(int bytes)
bytes - The number of new bytes write to the server.