View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package org.apache.commons.net.pop3;
19  
20  /***
21   * POP3Command stores POP3 command code constants.
22   * <p>
23   * <p>
24   * @author Daniel F. Savarese
25   ***/
26  
27  public final class POP3Command
28  {
29      /*** Send user name. ***/
30      public static final int USER = 0;
31      /*** Send password. ***/
32      public static final int PASS = 1;
33      /*** Quit session. ***/
34      public static final int QUIT = 2;
35      /*** Get status. ***/
36      public static final int STAT = 3;
37      /*** List message(s). ***/
38      public static final int LIST = 4;
39      /*** Retrieve message(s). ***/
40      public static final int RETR = 5;
41      /*** Delete message(s). ***/
42      public static final int DELE = 6;
43      /*** No operation.  Used as a session keepalive. ***/
44      public static final int NOOP = 7;
45      /*** Reset session. ***/
46      public static final int RSET = 8;
47      /*** Authorization. ***/
48      public static final int APOP = 9;
49      /*** Retrieve top number lines from message. ***/
50      public static final int TOP = 10;
51      /*** List unique message identifier(s). ***/
52      public static final int UIDL = 11;
53  
54      static final String[] _commands = {
55                                            "USER", "PASS", "QUIT", "STAT", "LIST", "RETR", "DELE", "NOOP", "RSET",
56                                            "APOP", "TOP", "UIDL"
57                                        };
58  
59      // Cannot be instantiated.
60      private POP3Command()
61      {}
62  
63      /***
64       * Get the POP3 protocol string command corresponding to a command code.
65       * <p>
66       * @return The POP3 protocol string command corresponding to a command code.
67       ***/
68      public static final String getCommand(int command)
69      {
70          return _commands[command];
71      }
72  }