001    /*
002     * Copyright 2001-2005 The Apache Software Foundation
003     *
004     * Licensed under the Apache License, Version 2.0 (the "License");
005     * you may not use this file except in compliance with the License.
006     * You may obtain a copy of the License at
007     *
008     *     http://www.apache.org/licenses/LICENSE-2.0
009     *
010     * Unless required by applicable law or agreed to in writing, software
011     * distributed under the License is distributed on an "AS IS" BASIS,
012     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013     * See the License for the specific language governing permissions and
014     * limitations under the License.
015     */
016    package org.apache.commons.net.pop3;
017    
018    /***
019     * POP3Command stores POP3 command code constants.
020     * <p>
021     * <p>
022     * @author Daniel F. Savarese
023     ***/
024    
025    public final class POP3Command
026    {
027        /*** Send user name. ***/
028        public static final int USER = 0;
029        /*** Send password. ***/
030        public static final int PASS = 1;
031        /*** Quit session. ***/
032        public static final int QUIT = 2;
033        /*** Get status. ***/
034        public static final int STAT = 3;
035        /*** List message(s). ***/
036        public static final int LIST = 4;
037        /*** Retrieve message(s). ***/
038        public static final int RETR = 5;
039        /*** Delete message(s). ***/
040        public static final int DELE = 6;
041        /*** No operation.  Used as a session keepalive. ***/
042        public static final int NOOP = 7;
043        /*** Reset session. ***/
044        public static final int RSET = 8;
045        /*** Authorization. ***/
046        public static final int APOP = 9;
047        /*** Retrieve top number lines from message. ***/
048        public static final int TOP = 10;
049        /*** List unique message identifier(s). ***/
050        public static final int UIDL = 11;
051    
052        static final String[] _commands = {
053                                              "USER", "PASS", "QUIT", "STAT", "LIST", "RETR", "DELE", "NOOP", "RSET",
054                                              "APOP", "TOP", "UIDL"
055                                          };
056    
057        // Cannot be instantiated.
058        private POP3Command()
059        {}
060    
061        /***
062         * Get the POP3 protocol string command corresponding to a command code.
063         * <p>
064         * @return The POP3 protocol string command corresponding to a command code.
065         ***/
066        public static final String getCommand(int command)
067        {
068            return _commands[command];
069        }
070    }