FTPClient client = new FTPClient();
OutputStream outStream = null;
try {
client.connect( "ftp.ibiblio.org" );
client.login( "anonymous", "" );
String remoteFile = "/pub/micro/commodore/schematics/computers/c64/c64bus.gif";
outStream = new FileOutputStream( "c64bus.gif" );
client.retrieveFile( remoteFile, outStream );
} catch(IOException ioe) {
System.out.println( "Error communicating with FTP server." );
} finally {
IOUtils.closeQuietly( outStream );
try {
client.disconnect();
} catch (IOException e) {
System.out.println( "Problem disconnecting from FTP server" );
}
}
secondExample();