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.pop3;
  17. /***
  18. * POP3Command stores POP3 command code constants.
  19. * <p>
  20. * <p>
  21. * @author Daniel F. Savarese
  22. ***/
  23. public final class POP3Command
  24. {
  25. /*** Send user name. ***/
  26. public static final int USER = 0;
  27. /*** Send password. ***/
  28. public static final int PASS = 1;
  29. /*** Quit session. ***/
  30. public static final int QUIT = 2;
  31. /*** Get status. ***/
  32. public static final int STAT = 3;
  33. /*** List message(s). ***/
  34. public static final int LIST = 4;
  35. /*** Retrieve message(s). ***/
  36. public static final int RETR = 5;
  37. /*** Delete message(s). ***/
  38. public static final int DELE = 6;
  39. /*** No operation. Used as a session keepalive. ***/
  40. public static final int NOOP = 7;
  41. /*** Reset session. ***/
  42. public static final int RSET = 8;
  43. /*** Authorization. ***/
  44. public static final int APOP = 9;
  45. /*** Retrieve top number lines from message. ***/
  46. public static final int TOP = 10;
  47. /*** List unique message identifier(s). ***/
  48. public static final int UIDL = 11;
  49. static final String[] _commands = {
  50. "USER", "PASS", "QUIT", "STAT", "LIST", "RETR", "DELE", "NOOP", "RSET",
  51. "APOP", "TOP", "UIDL"
  52. };
  53. // Cannot be instantiated.
  54. private POP3Command()
  55. {}
  56. /***
  57. * Get the POP3 protocol string command corresponding to a command code.
  58. * <p>
  59. * @return The POP3 protocol string command corresponding to a command code.
  60. ***/
  61. public static final String getCommand(int command)
  62. {
  63. return _commands[command];
  64. }
  65. }