View Javadoc

1   /*
2    * Copyright 2001-2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.commons.net.nntp;
17  
18  /***
19   * NNTPCommand stores a set of constants for NNTP command codes.  To interpret
20   * the meaning of the codes, familiarity with RFC 977 is assumed.
21   * <p>
22   * @author Daniel F. Savarese
23   * @author Rory Winston
24   * @author Ted Wise
25   ***/
26  
27  public final class NNTPCommand
28  {
29  
30      public static final int ARTICLE   = 0;
31      public static final int BODY      = 1;
32      public static final int GROUP     = 2;
33      public static final int HEAD      = 3;
34      public static final int HELP      = 4;
35      public static final int IHAVE     = 5;
36      public static final int LAST      = 6;
37      public static final int LIST      = 7;
38      public static final int NEWGROUPS = 8;
39      public static final int NEWNEWS   = 9;
40      public static final int NEXT      = 10;
41      public static final int POST      = 11;
42      public static final int QUIT      = 12;
43      public static final int SLAVE     = 13;
44      public static final int STAT      = 14;
45      public static final int AUTHINFO  = 15;
46      public static final int XOVER     = 16;
47      public static final int XHDR      = 17;
48  
49      // Cannot be instantiated
50      private NNTPCommand()
51      {}
52  
53      static final String[] _commands = {
54          "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST",
55          "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT",
56          "AUTHINFO", "XOVER", "XHDR"
57      };
58  
59  
60      /***
61       * Retrieve the NNTP protocol command string corresponding to a specified
62       * command code.
63       * <p>
64       * @param command The command code.
65       * @return The NNTP protcol command string corresponding to a specified
66       *         command code.
67       ***/
68      public static final String getCommand(int command)
69      {
70          return _commands[command];
71      }
72  
73  }
74  
75  /* Emacs configuration
76   * Local variables:        **
77   * mode:             java  **
78   * c-basic-offset:   4     **
79   * indent-tabs-mode: nil   **
80   * End:                    **
81   */