    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 the meaning of the codes, familiarity with RFC 977 is assumed.
    022 */
    023
    024public final class NNTPCommand {
    025
    026    public static final int ARTICLE = 0;
    027    public static final int BODY = 1;
    028    public static final int GROUP = 2;
    029    public static final int HEAD = 3;
    030    public static final int HELP = 4;
    031    public static final int IHAVE = 5;
    032    public static final int LAST = 6;
    033    public static final int LIST = 7;
    034    public static final int NEWGROUPS = 8;
    035    public static final int NEWNEWS = 9;
    036    public static final int NEXT = 10;
    037    public static final int POST = 11;
    038    public static final int QUIT = 12;
    039    public static final int SLAVE = 13;
    040    public static final int STAT = 14;
    041    public static final int AUTHINFO = 15;
    042    public static final int XOVER = 16;
    043    public static final int XHDR = 17;
    044
    045    private static final String[] commands = { "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST", "NEWGROUPS", "NEWNEWS", "NEXT", "POST",
    046            "QUIT", "SLAVE", "STAT", "AUTHINFO", "XOVER", "XHDR" };
    047
    048    /**
    049     * Retrieve the NNTP protocol command string corresponding to a specified command code.
    050     * <p>
    051     *
    052     * @param command The command code.
    053     * @return The NNTP protcol command string corresponding to a specified command code.
    054     */
    055    public static String getCommand(final int command) {
    056        return commands[command];
    057    }
    058
    059    // Cannot be instantiated
    060    private NNTPCommand() {
    061    }
    062
    063}