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 018 package 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 * <p> 024 * @author Daniel F. Savarese 025 * @author Rory Winston 026 * @author Ted Wise 027 ***/ 028 029 public final class NNTPCommand 030 { 031 032 public static final int ARTICLE = 0; 033 public static final int BODY = 1; 034 public static final int GROUP = 2; 035 public static final int HEAD = 3; 036 public static final int HELP = 4; 037 public static final int IHAVE = 5; 038 public static final int LAST = 6; 039 public static final int LIST = 7; 040 public static final int NEWGROUPS = 8; 041 public static final int NEWNEWS = 9; 042 public static final int NEXT = 10; 043 public static final int POST = 11; 044 public static final int QUIT = 12; 045 public static final int SLAVE = 13; 046 public static final int STAT = 14; 047 public static final int AUTHINFO = 15; 048 public static final int XOVER = 16; 049 public static final int XHDR = 17; 050 051 // Cannot be instantiated 052 private NNTPCommand() 053 {} 054 055 static final String[] _commands = { 056 "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST", 057 "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT", 058 "AUTHINFO", "XOVER", "XHDR" 059 }; 060 061 062 /*** 063 * Retrieve the NNTP protocol command string corresponding to a specified 064 * command code. 065 * <p> 066 * @param command The command code. 067 * @return The NNTP protcol command string corresponding to a specified 068 * command code. 069 ***/ 070 public static final String getCommand(int command) 071 { 072 return _commands[command]; 073 } 074 075 } 076 077 /* Emacs configuration 078 * Local variables: ** 079 * mode: java ** 080 * c-basic-offset: 4 ** 081 * indent-tabs-mode: nil ** 082 * End: ** 083 */