private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' // to handle buggy IMAP servers, we tolerate multiple spaces as // well as spaces after the left paren or before the right paren List<String> result = new ArrayList<>(); while (!isNextNonSpace(')')) { String s = atom ? readAtomString() : readString(); if (s == null) // not the expected string or atom break; result.add(s); } return result.toArray(new String[result.size()]); }
private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' List<String> result = new ArrayList<String>(); skipSpaces(); if (peekByte() != ')') { do { result.add(atom ? readAtomString() : readString()); } while (index < size && buffer[index++] != ')'); } else index++; // skip ')' return result.toArray(new String[result.size()]); }
public Status(Response r) throws ParsingException { mbox = BASE64MailboxDecoder.decode(r.readAtomString());
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<>(); while (!r.isNextNonSpace(')')) { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
public Status(Response r) throws ParsingException { mbox = r.readAtomString(); if (!r.supportsUtf8()) mbox = BASE64MailboxDecoder.decode(mbox);
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<Quota.Resource>(); while (r.peekByte() != ')') { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } r.readByte(); q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' // to handle buggy IMAP servers, we tolerate multiple spaces as // well as spaces after the left paren or before the right paren List<String> result = new ArrayList<>(); while (!isNextNonSpace(')')) { String s = atom ? readAtomString() : readString(); if (s == null) // not the expected string or atom break; result.add(s); } return result.toArray(new String[result.size()]); }
private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' // to handle buggy IMAP servers, we tolerate multiple spaces as // well as spaces after the left paren or before the right paren List<String> result = new ArrayList<>(); while (!isNextNonSpace(')')) { String s = atom ? readAtomString() : readString(); if (s == null) // not the expected string or atom break; result.add(s); } return result.toArray(new String[result.size()]); }
private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' // to handle buggy IMAP servers, we tolerate multiple spaces as // well as spaces after the left paren or before the right paren List<String> result = new ArrayList<>(); while (!isNextNonSpace(')')) { String s = atom ? readAtomString() : readString(); if (s == null) // not the expected string or atom break; result.add(s); } return result.toArray(new String[result.size()]); }
private String[] readStringList(boolean atom) { skipSpaces(); if (buffer[index] != '(') { // not what we expected return null; } index++; // skip '(' // to handle buggy IMAP servers, we tolerate multiple spaces as // well as spaces after the left paren or before the right paren List<String> result = new ArrayList<>(); while (!isNextNonSpace(')')) { String s = atom ? readAtomString() : readString(); if (s == null) // not the expected string or atom break; result.add(s); } return result.toArray(new String[result.size()]); }
public Status(Response r) throws ParsingException { mbox = r.readAtomString(); // mailbox := astring r.skipSpaces(); if (r.readByte() != '(') throw new ParsingException("parse error in STATUS"); do { String attr = r.readAtom(); if (attr.equalsIgnoreCase("MESSAGES")) total = r.readNumber(); else if (attr.equalsIgnoreCase("RECENT")) recent = r.readNumber(); else if (attr.equalsIgnoreCase("UIDNEXT")) uidnext = r.readLong(); else if (attr.equalsIgnoreCase("UIDVALIDITY")) uidvalidity = r.readLong(); else if (attr.equalsIgnoreCase("UNSEEN")) unseen = r.readNumber(); } while (r.readByte() != ')'); }
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<>(); while (!r.isNextNonSpace(')')) { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
public Status(Response r) throws ParsingException { mbox = r.readAtomString(); // mailbox := astring
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<>(); while (!r.isNextNonSpace(')')) { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<>(); while (!r.isNextNonSpace(')')) { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); List<Quota.Resource> v = new ArrayList<>(); while (!r.isNextNonSpace(')')) { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.add(res); } } q.resources = v.toArray(new Quota.Resource[v.size()]); return q; }
public Status(Response r) throws ParsingException { mbox = r.readAtomString(); if (!r.supportsUtf8()) mbox = BASE64MailboxDecoder.decode(mbox);
public Status(Response r) throws ParsingException { mbox = r.readAtomString(); if (!r.supportsUtf8()) mbox = BASE64MailboxDecoder.decode(mbox);
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); Vector v = new Vector(); while (r.peekByte() != ')') { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.addElement(res); } } r.readByte(); q.resources = new Quota.Resource[v.size()]; v.copyInto(q.resources); return q; }
/** * Parse a QUOTA response. */ private Quota parseQuota(Response r) throws ParsingException { // quota_response ::= "QUOTA" SP astring SP quota_list String quotaRoot = r.readAtomString(); // quotaroot ::= astring Quota q = new Quota(quotaRoot); r.skipSpaces(); // quota_list ::= "(" #quota_resource ")" if (r.readByte() != '(') throw new ParsingException("parse error in QUOTA"); Vector v = new Vector(); while (r.peekByte() != ')') { // quota_resource ::= atom SP number SP number String name = r.readAtom(); if (name != null) { long usage = r.readLong(); long limit = r.readLong(); Quota.Resource res = new Quota.Resource(name, usage, limit); v.addElement(res); } } r.readByte(); q.resources = new Quota.Resource[v.size()]; v.copyInto(q.resources); return q; }