1. /*
  2. * Copyright 2001-2004 The Apache Software Foundation
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. package org.apache.commons.net.nntp;
  17. /***
  18. * NNTPCommand stores a set of constants for NNTP command codes. To interpret
  19. * the meaning of the codes, familiarity with RFC 977 is assumed.
  20. * <p>
  21. * @author Daniel F. Savarese
  22. * @author Rory Winston
  23. * @author Ted Wise
  24. ***/
  25. public final class NNTPCommand
  26. {
  27. public static final int ARTICLE = 0;
  28. public static final int BODY = 1;
  29. public static final int GROUP = 2;
  30. public static final int HEAD = 3;
  31. public static final int HELP = 4;
  32. public static final int IHAVE = 5;
  33. public static final int LAST = 6;
  34. public static final int LIST = 7;
  35. public static final int NEWGROUPS = 8;
  36. public static final int NEWNEWS = 9;
  37. public static final int NEXT = 10;
  38. public static final int POST = 11;
  39. public static final int QUIT = 12;
  40. public static final int SLAVE = 13;
  41. public static final int STAT = 14;
  42. public static final int AUTHINFO = 15;
  43. public static final int XOVER = 16;
  44. public static final int XHDR = 17;
  45. // Cannot be instantiated
  46. private NNTPCommand()
  47. {}
  48. static final String[] _commands = {
  49. "ARTICLE", "BODY", "GROUP", "HEAD", "HELP", "IHAVE", "LAST", "LIST",
  50. "NEWGROUPS", "NEWNEWS", "NEXT", "POST", "QUIT", "SLAVE", "STAT",
  51. "AUTHINFO", "XOVER", "XHDR"
  52. };
  53. /***
  54. * Retrieve the NNTP protocol command string corresponding to a specified
  55. * command code.
  56. * <p>
  57. * @param command The command code.
  58. * @return The NNTP protcol command string corresponding to a specified
  59. * command code.
  60. ***/
  61. public static final String getCommand(int command)
  62. {
  63. return _commands[command];
  64. }
  65. }
  66. /* Emacs configuration
  67. * Local variables: **
  68. * mode: java **
  69. * c-basic-offset: 4 **
  70. * indent-tabs-mode: nil **
  71. * End: **
  72. */