1 17 package org.alfresco.filesys.ftp; 18 19 24 public class FTPCommand 25 { 26 27 29 public final static int User = 0; 30 public final static int Pass = 1; 31 public final static int Acct = 2; 32 public final static int Cwd = 3; 33 public final static int Cdup = 4; 34 public final static int Smnt = 5; 35 public final static int Rein = 6; 36 public final static int Quit = 7; 37 public final static int Port = 8; 38 public final static int Pasv = 9; 39 public final static int Type = 10; 40 public final static int Stru = 11; 41 public final static int Mode = 12; 42 public final static int Retr = 13; 43 public final static int Stor = 14; 44 public final static int Stou = 15; 45 public final static int Appe = 16; 46 public final static int Allo = 17; 47 public final static int Rest = 18; 48 public final static int Rnfr = 19; 49 public final static int Rnto = 20; 50 public final static int Abor = 21; 51 public final static int Dele = 22; 52 public final static int Rmd = 23; 53 public final static int Mkd = 24; 54 public final static int Pwd = 25; 55 public final static int List = 26; 56 public final static int Nlst = 27; 57 public final static int Site = 28; 58 public final static int Syst = 29; 59 public final static int Stat = 30; 60 public final static int Help = 31; 61 public final static int Noop = 32; 62 public final static int Mdtm = 33; 63 public final static int Size = 34; 64 public final static int Opts = 35; 65 public final static int Feat = 36; 66 public final static int XPwd = 37; 67 public final static int XMkd = 38; 68 public final static int XRmd = 39; 69 public final static int XCup = 40; 70 public final static int XCwd = 41; 71 72 public final static int MaxId = 41; 73 74 public final static int InvalidCmd = -1; 75 76 78 private static final String [] _cmds = { "USER", "PASS", "ACCT", "CWD", "CDUP", "SMNT", "REIN", "QUIT", "PORT", 79 "PASV", "TYPE", "STRU", "MODE", "RETR", "STOR", "STOU", "APPE", "ALLO", "REST", "RNFR", "RNTO", "ABOR", 80 "DELE", "RMD", "MKD", "PWD", "LIST", "NLST", "SITE", "SYST", "STAT", "HELP", "NOOP", "MDTM", "SIZE", 81 "OPTS", "FEAT", "XPWD", "XMKD", "XRMD", "XCUP", "XCWD" }; 82 83 89 public final static int getCommandId(String cmd) 90 { 91 92 94 if (cmd == null) 95 return InvalidCmd; 96 97 99 for (int i = 0; i <= MaxId; i++) 100 if (_cmds[i].equalsIgnoreCase(cmd)) 101 return i; 102 103 105 return InvalidCmd; 106 } 107 108 114 public final static String getCommandName(int id) 115 { 116 if (id < 0 || id > MaxId) 117 return null; 118 return _cmds[id]; 119 } 120 } 121 | Popular Tags |