1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.geronimo.javamail.store.pop3.connection;
21
22 import java.io.ByteArrayInputStream;
23
24 import java.util.ArrayList;
25 import java.util.List;
26
27 import javax.mail.MessagingException;
28
29
30
31
32
33
34
35
36
37
38
39
40
41 public class POP3ListResponse extends POP3Response {
42
43 private int msgnum = 0;
44
45 private int size = 0;
46
47 private List multipleMsgs = null;
48
49 POP3ListResponse(POP3Response baseRes) throws MessagingException {
50 super(baseRes.getStatus(), baseRes.getFirstLine(), baseRes.getData());
51
52
53 if (OK == getStatus()) {
54
55
56 if (baseRes.getData() == null) {
57 String[] args = getFirstLine().split(SPACE);
58 try {
59 msgnum = Integer.parseInt(args[0]);
60 } catch (NumberFormatException e) {
61 throw new MessagingException("Invalid response for LIST command", e);
62 }
63 try {
64 size = Integer.parseInt(args[1]);
65 } catch (NumberFormatException e) {
66 throw new MessagingException("Invalid response for LIST command", e);
67 }
68 } else {
69 int totalMsgs = 0;
70 String[] args = getFirstLine().split(SPACE);
71 try {
72 totalMsgs = Integer.parseInt(args[0]);
73 } catch (NumberFormatException e) {
74 throw new MessagingException("Invalid response for LIST command", e);
75 }
76 multipleMsgs = new ArrayList(totalMsgs);
77
78 }
79
80 }
81 }
82
83 public int getMessageNumber() {
84 return msgnum;
85 }
86
87 public int getSize() {
88 return size;
89 }
90
91
92
93
94
95 public List getMultipleMessageDetails() {
96 return multipleMsgs;
97 }
98
99 }