View Javadoc

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