View Javadoc

1   /**
2    *
3    * Copyright 2003-2005 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  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.geronimo.javamail.store.pop3;
19  
20  import java.io.InputStream;
21  
22  /**
23   * An abstraction for POP3 Response
24   * 
25   * @see org.apache.geronimo.javamail.store.pop3.response.POP3ResponseFactory
26   * @see org.apache.geronimo.javamail.store.pop3.response.DefaultPOP3Response
27   * @see org.apache.geronimo.javamail.store.pop3.response.POP3StatusResponse
28   * 
29   * @version $Rev: 432884 $ $Date: 2006-08-19 14:53:20 -0700 (Sat, 19 Aug 2006) $
30   */
31  public interface POP3Response {
32  
33      /**
34       * Returns the response OK or ERR
35       * <ul>
36       * <li>OK --> +OK in pop3 spec
37       * <li>ERR --> -ERR in pop3 spec
38       * </ul>
39       */
40      public int getStatus();
41  
42      /**
43       * this corresponds to the line with the status however the status will be
44       * removed and the remainder is returned. Ex. "+OK 132 3023673" is the first
45       * line of response for a STAT command this method will return "132 3023673"
46       * 
47       * So any subsequent process can parse the params 132 as no of msgs and
48       * 3023674 as the size.
49       * 
50       * @see org.apache.geronimo.javamail.store.pop3.response.POP3StatusResponse
51       */
52      public String getFirstLine();
53  
54      /**
55       * This way we are not restricting anybody as InputStream.class is the most
56       * basic type to represent an inputstream and ppl can decorate it anyway
57       * they want, for ex BufferedInputStream or as an InputStreamReader allowing
58       * maximum flexibility in using it.
59       */
60      public InputStream getData();
61  }