Fork me on GitHub

Commons FTP Client

org.onehippo.forge.utilities.commons.ftp.SimpleFtpClient

Utility wrapping org.apache.commons.net.ftp.FTPClient.
Basic usage:

  SimpleFtpClient client = new SimpleFtpClient(user, password, server, port);
  SimpleFtpClientResult result = client.saveFile(stream, fileName, directory,
                                                isBinary, overwrite, createDirectories);
  if (result == SimpleFtpClientResult.CREATED) {
    // succes!
  }
  client.close();

Please refer to the source code and test class org.onehippo.forge.utilities.commons.ftp.SimpleFtpClientTest for details.