View Javadoc
1 package org.apache.commons.net.ftp; 2 3 /* ==================================================================== 4 * The Apache Software License, Version 1.1 5 * 6 * Copyright (c) 2001 The Apache Software Foundation. All rights 7 * reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions 11 * are met: 12 * 13 * 1. Redistributions of source code must retain the above copyright 14 * notice, this list of conditions and the following disclaimer. 15 * 16 * 2. Redistributions in binary form must reproduce the above copyright 17 * notice, this list of conditions and the following disclaimer in 18 * the documentation and/or other materials provided with the 19 * distribution. 20 * 21 * 3. The end-user documentation included with the redistribution, 22 * if any, must include the following acknowledgment: 23 * "This product includes software developed by the 24 * Apache Software Foundation (http://www.apache.org/)." 25 * Alternately, this acknowledgment may appear in the software itself, 26 * if and wherever such third-party acknowledgments normally appear. 27 * 28 * 4. The names "Apache" and "Apache Software Foundation" and 29 * "Apache Commons" must not be used to endorse or promote products 30 * derived from this software without prior written permission. For 31 * written permission, please contact apache@apache.org. 32 * 33 * 5. Products derived from this software may not be called "Apache", 34 * nor may "Apache" appear in their name, without 35 * prior written permission of the Apache Software Foundation. 36 * 37 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED 38 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 39 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 40 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR 41 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 42 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 43 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 44 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 45 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 46 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 47 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 48 * SUCH DAMAGE. 49 * ==================================================================== 50 * 51 * This software consists of voluntary contributions made by many 52 * individuals on behalf of the Apache Software Foundation. For more 53 * information on the Apache Software Foundation, please see 54 * <http://www.apache.org/>;. 55 */ 56 57 /**** 58 * FTPCommand stores a set of constants for FTP command codes. To interpret 59 * the meaning of the codes, familiarity with RFC 959 is assumed. 60 * The mnemonic constant names are transcriptions from the code descriptions 61 * of RFC 959. For those who think in terms of the actual FTP commands, 62 * a set of constants such as <a href="#USER"> USER </a> are provided 63 * where the constant name is the same as the FTP command. 64 * <p> 65 * <p> 66 * @author Daniel F. Savarese 67 ***/ 68 69 public final class FTPCommand 70 { 71 72 73 public static final int USER = 0; 74 public static final int PASS = 1; 75 public static final int ACCT = 2; 76 public static final int CWD = 3; 77 public static final int CDUP = 4; 78 public static final int SMNT = 5; 79 public static final int REIN = 6; 80 public static final int QUIT = 7; 81 public static final int PORT = 8; 82 public static final int PASV = 9; 83 public static final int TYPE = 10; 84 public static final int STRU = 11; 85 public static final int MODE = 12; 86 public static final int RETR = 13; 87 public static final int STOR = 14; 88 public static final int STOU = 15; 89 public static final int APPE = 16; 90 public static final int ALLO = 17; 91 public static final int REST = 18; 92 public static final int RNFR = 19; 93 public static final int RNTO = 20; 94 public static final int ABOR = 21; 95 public static final int DELE = 22; 96 public static final int RMD = 23; 97 public static final int MKD = 24; 98 public static final int PWD = 25; 99 public static final int LIST = 26; 100 public static final int NLST = 27; 101 public static final int SITE = 28; 102 public static final int SYST = 29; 103 public static final int STAT = 30; 104 public static final int HELP = 31; 105 public static final int NOOP = 32; 106 107 public static final int USERNAME = USER; 108 public static final int PASSWORD = PASS; 109 public static final int ACCOUNT = ACCT; 110 public static final int CHANGE_WORKING_DIRECTORY = CWD; 111 public static final int CHANGE_TO_PARENT_DIRECTORY = CDUP; 112 public static final int STRUCTURE_MOUNT = SMNT; 113 public static final int REINITIALIZE = REIN; 114 public static final int LOGOUT = QUIT; 115 public static final int DATA_PORT = PORT; 116 public static final int PASSIVE = PASV; 117 public static final int REPRESENTATION_TYPE = TYPE; 118 public static final int FILE_STRUCTURE = STRU; 119 public static final int TRANSFER_MODE = MODE; 120 public static final int RETRIEVE = RETR; 121 public static final int STORE = STOR; 122 public static final int STORE_UNIQUE = STOU; 123 public static final int APPEND = APPE; 124 public static final int ALLOCATE = ALLO; 125 public static final int RESTART = REST; 126 public static final int RENAME_FROM = RNFR; 127 public static final int RENAME_TO = RNTO; 128 public static final int ABORT = ABOR; 129 public static final int DELETE = DELE; 130 public static final int REMOVE_DIRECTORY = RMD; 131 public static final int MAKE_DIRECTORY = MKD; 132 public static final int PRINT_WORKING_DIRECTORY = PWD; 133 // public static final int LIST = LIST; 134 public static final int NAME_LIST = NLST; 135 public static final int SITE_PARAMETERS = SITE; 136 public static final int SYSTEM = SYST; 137 public static final int STATUS = STAT; 138 //public static final int HELP = HELP; 139 //public static final int NOOP = NOOP; 140 141 // Cannot be instantiated 142 private FTPCommand() 143 {} 144 145 static final String[] _commands = { 146 "USER", "PASS", "ACCT", "CWD", "CDUP", "SMNT", "REIN", "QUIT", "PORT", 147 "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO", 148 "REST", "RNFR", "RNTO", "ABOR", "DELE", "RMD", "MKD", "PWD", "LIST", 149 "NLST", "SITE", "SYST", "STAT", "HELP", "NOOP" 150 }; 151 152 153 /**** 154 * Retrieve the FTP protocol command string corresponding to a specified 155 * command code. 156 * <p> 157 * @param The command code. 158 * @return The FTP protcol command string corresponding to a specified 159 * command code. 160 ***/ 161 public static final String getCommand(int command) 162 { 163 return _commands[command]; 164 } 165 166 }

This page was automatically generated by Maven