Skip to content

Instantly share code, notes, and snippets.

@igordeoliveirasa
Created February 27, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igordeoliveirasa/34a6957f82b90333e2fc to your computer and use it in GitHub Desktop.
Save igordeoliveirasa/34a6957f82b90333e2fc to your computer and use it in GitHub Desktop.
FTP Client Java
public class CharlieFTPClient {
FTPClient ftpClient;
public CharlieFTPClient(FTPClient ftpClient) {
this.ftpClient = ftpClient;
}
public boolean connect(String ip, String userName, String pass) throws IOException {
ftpClient.setConnectTimeout(10 * 1000);
ftpClient.connect(InetAddress.getByName(ip));
//Log.i("isFTPConnected", String.valueOf(status));
return ftpClient.login(userName, pass);
}
public void disconnect() throws IOException {
ftpClient.disconnect();
}
public boolean sendFile(org.apache.commons.net.ftp.FTPClient ftpClient, File file, String remoteFtpPath) throws IOException {
return ftpClient.storeFile(remoteFtpPath, new FileInputStream(file));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment