Created
February 27, 2015 19:34
-
-
Save igordeoliveirasa/34a6957f82b90333e2fc to your computer and use it in GitHub Desktop.
FTP Client Java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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