/** * 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<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; }
/** * If the response contains a CAPABILITY response code, extract * it and save the capabilities. * * @param r the response */ protected void setCapabilities(Response r) { byte b; while ((b = r.readByte()) > 0 && b != (byte)'[') ; if (b == 0) return; String s; s = r.readAtom(); if (!s.equalsIgnoreCase("CAPABILITY")) return; capabilities = new HashMap<String, String>(10); authmechs = new ArrayList<String>(5); parseCapabilities(r); }
String attr = r.readAtom(); if (attr.equalsIgnoreCase("MESSAGES")) total = r.readNumber();
/** * If the response contains a CAPABILITY response code, extract * it and save the capabilities. * * @param r the response */ protected void setCapabilities(Response r) { byte b; while ((b = r.readByte()) > 0 && b != (byte)'[') ; if (b == 0) return; String s; s = r.readAtom(); if (!s.equalsIgnoreCase("CAPABILITY")) return; capabilities = new HashMap<>(10); authmechs = new ArrayList<>(5); parseCapabilities(r); }
String attr = r.readAtom(); if (attr == null) throw new ParsingException("parse error in STATUS");
while ((s = r.readAtom()) != null) { if (s.length() == 0) { if (r.peekByte() == (byte)']')
while ((s = r.readAtom()) != null) { if (s.length() == 0) { if (r.peekByte() == (byte)']')
/** * Parse out one of the three sets of namespaces. */ private Namespace[] getNamespaces(Response r) throws ProtocolException { // Namespace = nil / "(" 1*( Namespace_Element) ")" if (r.isNextNonSpace('(')) { List<Namespace> v = new ArrayList<>(); do { Namespace ns = new Namespace(r); v.add(ns); } while (!r.isNextNonSpace(')')); return v.toArray(new Namespace[v.size()]); } else { String s = r.readAtom(); if (s == null) throw new ProtocolException("Expected NIL, got null"); if (!s.equalsIgnoreCase("NIL")) throw new ProtocolException("Expected NIL, got " + s); return null; } } }
/** * Parse out one of the three sets of namespaces. */ private Namespace[] getNamespaces(Response r) throws ProtocolException { r.skipSpaces(); // Namespace = nil / "(" 1*( Namespace_Element) ")" if (r.peekByte() == '(') { List<Namespace> v = new ArrayList<Namespace>(); r.readByte(); do { Namespace ns = new Namespace(r); v.add(ns); } while (r.peekByte() != ')'); r.readByte(); return v.toArray(new Namespace[v.size()]); } else { String s = r.readAtom(); if (s == null) throw new ProtocolException("Expected NIL, got null"); if (!s.equalsIgnoreCase("NIL")) throw new ProtocolException("Expected NIL, got " + s); return null; } } }
/** * If the response contains an APPENDUID response code, extract * it and return an AppendUID object with the information. */ private AppendUID getAppendUID(Response r) { if (!r.isOK()) return null; byte b; while ((b = r.readByte()) > 0 && b != (byte)'[') ; if (b == 0) return null; String s; s = r.readAtom(); if (!s.equalsIgnoreCase("APPENDUID")) return null; long uidvalidity = r.readLong(); long uid = r.readLong(); return new AppendUID(uidvalidity, uid); }
/** * If the response contains an APPENDUID response code, extract * it and return an AppendUID object with the information. */ private AppendUID getAppendUID(Response r) { if (!r.isOK()) return null; byte b; while ((b = r.readByte()) > 0 && b != (byte)'[') ; if (b == 0) return null; String s; s = r.readAtom(); if (!s.equalsIgnoreCase("APPENDUID")) return null; long uidvalidity = r.readLong(); long uid = r.readLong(); return new AppendUID(uidvalidity, uid); }
"Missing '\"' at end of QUOTED_CHAR"); } else { String s = r.readAtom(); if (s == null) throw new ProtocolException("Expected NIL, got null");
"Missing '\"' at end of QUOTED_CHAR"); } else { String s = r.readAtom(); if (s == null) throw new ProtocolException("Expected NIL, got null");
String s = r.readAtom(); if (s.equalsIgnoreCase("HIGHESTMODSEQ")) highestmodseq = r.readLong();
String s = r.readAtom(); if (s.equalsIgnoreCase("HIGHESTMODSEQ")) highestmodseq = r.readLong();