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   ***/
24  
25  public final class NNTPCommand
26  {
27  
28      public static final int ARTICLE   = 0;
29      public static final int BODY      = 1;
30      public static final int GROUP     = 2;
31      public static final int HEAD      = 3;
32      public static final int HELP      = 4;
33      public static final int IHAVE     = 5;
34      public static final int LAST      = 6;
35      public static final int LIST      = 7;
36      public static final int NEWGROUPS = 8;
37      public static final int NEWNEWS   = 9;
38      public static final int NEXT      = 10;
39      public static final int POST      = 11;
40      public static final int QUIT      = 12;
41      public static final int SLAVE     = 13;
42      public static final int STAT      = 14;
43      public static final int AUTHINFO  = 15;
44      public static final int XOVER     = 16;
45      public static final int XHDR      = 17;
46  
47      // Cannot be instantiated
48      private NNTPCommand()
49      {}
50  
51      private static final String[] _commands = {
52          "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST",
53          "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT",
54          "AUTHINFO", "XOVER", "XHDR"
55      };
56  
57  
58      /***
59       * Retrieve the NNTP protocol command string corresponding to a specified
60       * command code.
61       * <p>
62       * @param command The command code.
63       * @return The NNTP protcol command string corresponding to a specified
64       *         command code.
65       ***/
66      public static final String getCommand(int command)
67      {
68          return _commands[command];
69      }
70  
71  }
72  
73  /* Emacs configuration
74   * Local variables:        **
75   * mode:             java  **
76   * c-basic-offset:   4     **
77   * indent-tabs-mode: nil   **
78   * End:                    **
79   */