design and implement a basic File Transfer Protocol (FTP) command line tool
SuperClasspackage org.mpilone.cmsc335.project1; import it.sauronsoftware.ftp4j.FTPClient; import it.sauronsoftware.ftp4j.FTPException; import it.sauronsoftware.ftp4j.FTPIllegalReplyException; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; /** * Utility class for building FTP {@link URL}s and {@link FTPClient}s. This * class follows the builder pattern where the builder is configured through a * series of setter calls and then instances of the target type are created with * the build methods. This class is thread-safe through simple synchronization. * * @author mpilone */ public class FTPBuilder { private String host; private int port; private String username; private String password; /** * Sets the host of the remote FTP site. * * @param host the host name or IP address * @return the builder */ public synchronized FTPBuilder setHost(String host) { this.host = host; return this; } /** * Sets the port of the remote FTP site. * * @param port the port number * @return the builder */ public synchronized FTPBuilder setPort(int port) { this.port = port; return this; } /** * Sets the username for authentication on the remote FTP site. * * @param username the username for remote authentication * @return the builder */ public synchronized FTPBuilder setUsername(String username) { this.username = username; return this; } /** * Sets the password for authentication on the remote FTP site. * * @param password the password for remote authentication * @return the builder */ public synchronized FTPBuilder setPassword(String password) { this.password = password; return this; } /** * Builds a new {@link FTPClient}, connects to the remote host, authenticates, * and configures the connection for passive, binary transfers. * * @return the new FTPClient instance * @throws IOException if any IO or FTP error...
10 years ago
Purchase the answer to view it

- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool.docx
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_2.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_3.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_4.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_5.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_6.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_7.txt
- design_and_implement_a_basic_file_transfer_protocol_ftp_command_line_tool_8.txt