View Javadoc

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