/** * This class implements a more complete FTP client. * * @version 1.0, 01/19/97 * @author Elliotte Rusty Harold */ import java.io.IOException; import sun.net.TransferProtocolClient; import sun.net.ftp.FtpClient; import java.util.Enumeration; import java.util.Vector; public class FullFtpClient extends FtpClient { /** New FullFtpClient connected to host host. */ public FullFtpClient(String host) throws IOException { super(host); } /** New FullFtpClient connected to host host, port port. */ public FullFtpClient(String host, int port) throws IOException { super(host, port); } /** Create an uninitialized FullFTP client. */ public FullFtpClient() {} /** Move up one directory in the ftp file system */ public void cdup() throws IOException { issueCommandCheck("CDUP"); } /** Create a new directory named s in the ftp file system */ public void mkdir(String s) throws IOException { issueCommandCheck("MKDIR " + s); } /** Delete the specified directory from the ftp file system */ public void rmdir(String s) throws IOException { issueCommandCheck("RMD " + s); } /** Delete the file s from the ftp file system */ public void delete(String s) throws IOException { issueCommandCheck("DELE " + s); } /** Get the name of the present working directory on the ftp file system */ public String pwd() throws IOException { issueCommandCheck("PWD"); StringBuffer result = new StringBuffer(); for (Enumeration e = serverResponse.elements(); e.hasMoreElements();) { result.append((String) e.nextElement()); } return result.toString(); } }