use of com.zimbra.cs.mailclient.imap.ImapInputStream in project zm-mailbox by Zimbra.
the class TestImapUtil method testUtf8Text.
public void testUtf8Text() throws Exception {
String msg = "UTF8: \u00c0\u00e5";
byte[] b = (msg + "\r\n").getBytes("UTF8");
ImapInputStream is = new ImapInputStream(new ByteArrayInputStream(b), new ImapConfig());
assertEquals(msg, is.readText());
is.skipCRLF();
}
use of com.zimbra.cs.mailclient.imap.ImapInputStream in project zm-mailbox by Zimbra.
the class TestImapUtil method getImapInputStream.
private static ImapInputStream getImapInputStream(String[] folders) {
StringBuilder sb = new StringBuilder();
for (String folder : folders) {
sb.append("* LIST () \"/\" \"").append(folder).append("\"\r\n");
}
ImapConfig config = new ImapConfig();
return new ImapInputStream(new ByteArrayInputStream(Ascii.getBytes(sb.toString())), config);
}
use of com.zimbra.cs.mailclient.imap.ImapInputStream in project zm-mailbox by Zimbra.
the class TestImapUtil method parseFolders.
private List<ListData> parseFolders(String[] folders) throws IOException {
List<ListData> lds = new ArrayList<ListData>();
ImapInputStream is = getImapInputStream(folders);
while (!is.isEOF()) {
is.skipChar('*');
is.skipChar(' ');
is.readAtom();
is.skipChar(' ');
lds.add(ListData.read(is));
is.skipCRLF();
}
return lds;
}
Aggregations