001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.net.nntp;
019
020/***
021 * NNTPCommand stores a set of constants for NNTP command codes.  To interpret
022 * the meaning of the codes, familiarity with RFC 977 is assumed.
023 ***/
024
025public final class NNTPCommand
026{
027
028    public static final int ARTICLE   = 0;
029    public static final int BODY      = 1;
030    public static final int GROUP     = 2;
031    public static final int HEAD      = 3;
032    public static final int HELP      = 4;
033    public static final int IHAVE     = 5;
034    public static final int LAST      = 6;
035    public static final int LIST      = 7;
036    public static final int NEWGROUPS = 8;
037    public static final int NEWNEWS   = 9;
038    public static final int NEXT      = 10;
039    public static final int POST      = 11;
040    public static final int QUIT      = 12;
041    public static final int SLAVE     = 13;
042    public static final int STAT      = 14;
043    public static final int AUTHINFO  = 15;
044    public static final int XOVER     = 16;
045    public static final int XHDR      = 17;
046
047    // Cannot be instantiated
048    private NNTPCommand()
049    {}
050
051    private static final String[] _commands = {
052        "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST",
053        "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT",
054        "AUTHINFO", "XOVER", "XHDR"
055    };
056
057
058    /***
059     * Retrieve the NNTP protocol command string corresponding to a specified
060     * command code.
061     * <p>
062     * @param command The command code.
063     * @return The NNTP protcol command string corresponding to a specified
064     *         command code.
065     ***/
066    public static final String getCommand(int command)
067    {
068        return _commands[command];
069    }
070
071}
072
073/* Emacs configuration
074 * Local variables:        **
075 * mode:             java  **
076 * c-basic-offset:   4     **
077 * indent-tabs-mode: nil   **
078 * End:                    **
079 */