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