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