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   * POP3MessageInfo is used to return information about messages stored on
22   * a POP3 server.  Its fields are used to mean slightly different things
23   * depending on the information being returned.
24   * <p>
25   * In response to a status command, <code> number </code>
26   * contains the number of messages in the mailbox, <code> size </code>
27   * contains the size of the mailbox in bytes, and <code> identifier </code>
28   * is null.
29   * <p>
30   * In response to a message listings, <code> number </code>
31   * contains the message number, <code> size </code> contains the
32   * size of the message in bytes, and <code> identifier </code> is null.
33   * <p>
34   * In response to unique identifier listings, <code> number </code> contains
35   * the message number, <code> size </code> is undefined, and
36   * <code> identifier </code> contains the message's unique identifier.
37   * <p>
38   * <p>
39   ***/
40  
41  public final class POP3MessageInfo
42  {
43      public int number;
44      public int size;
45      public String identifier;
46  
47      /***
48       * Creates a POP3MessageInfo instance with <code>number</code> and
49       * <code> size </code> set to 0, and <code>identifier</code> set to
50       * null.
51       ***/
52      public POP3MessageInfo()
53      {
54          this(0, null, 0);
55      }
56  
57      /***
58       * Creates a POP3MessageInfo instance with <code>number</code> set
59       * to <code> num </code>, <code> size </code> set to <code> octets </code>,
60       * and <code>identifier</code> set to null.
61       ***/
62      public POP3MessageInfo(int num, int octets)
63      {
64          this(num, null, octets);
65      }
66  
67      /***
68       * Creates a POP3MessageInfo instance with <code>number</code> set
69       * to <code> num </code>, <code> size </code> undefined,
70       * and <code>identifier</code> set to <code>uid</code>.
71       ***/
72      public POP3MessageInfo(int num, String uid)
73      {
74          this(num, uid, -1);
75      }
76  
77      private POP3MessageInfo(int num, String uid, int size) {
78          this.number = num;
79          this.size = size;
80          this.identifier = uid;
81      }
82  }