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