1 22 23 package gnu.mail.providers.imap4; 24 25 import java.util.List ; 26 27 33 public class IMAPResponse 34 { 35 36 39 public static final String UNTAGGED = "*".intern(); 40 41 44 public static final String CONTINUATION = "+".intern(); 45 46 49 protected String tag; 50 51 54 protected String id; 55 56 59 protected int count = -1; 60 61 64 protected String mailbox; 65 66 69 protected List code; 70 71 74 protected byte[] content; 75 76 79 protected String text; 80 81 public String getTag() 82 { 83 return tag; 84 } 85 86 public boolean isTagged() 87 { 88 return (tag!=UNTAGGED && tag!=CONTINUATION); 89 } 90 91 public boolean isUntagged() 92 { 93 return (tag==UNTAGGED); 94 } 95 96 public boolean isContinuation() 97 { 98 return (tag==CONTINUATION); 99 } 100 101 public String getID() 102 { 103 return id; 104 } 105 106 public int getCount() 107 { 108 return count; 109 } 110 111 public List getResponseCode() 112 { 113 return code; 114 } 115 116 public byte[] getContent() 117 { 118 return content; 119 } 120 121 public String getText() 122 { 123 return text; 124 } 125 126 129 public String toString() 130 { 131 StringBuffer buffer = new StringBuffer (); 132 buffer.append(tag); 133 if (count!=-1) 134 { 135 buffer.append(" \u001b[00;31m"); 136 buffer.append(count); 137 buffer.append("\u001b[00m"); 138 } 139 buffer.append(" \u001b[01m"); 140 buffer.append(id); 141 buffer.append("\u001b[00m"); 142 if (mailbox!=null) 143 { 144 buffer.append(" \u001b[00;35m"); 145 buffer.append(mailbox); 146 buffer.append("\u001b[00m"); 147 } 148 if (code!=null) 149 { 150 buffer.append(" \u001b[00;36m"); 151 buffer.append(code); 152 buffer.append("\u001b[00m"); 153 } 154 if (content!=null) 155 { 156 buffer.append(" \u001b[00;31m{"); 157 buffer.append(content.length); 158 buffer.append("}\u001b[00m"); 159 } 160 if (text!=null) 161 { 162 buffer.append(" \u001b[00;33m"); 163 buffer.append(text); 164 buffer.append("\u001b[00m"); 165 } 166 return buffer.toString(); 167 } 168 169 } 170 | Popular Tags |