in dom/src/main/java/org/apache/james/mime4j/field/address/LenientAddressParser.java [87:127]
DomainList parseRoute(final ByteSequence buf, final ParserCursor cursor, final BitSet delimiters) {
BitSet bitset = RawFieldParser.INIT_BITSET(COMMA, COLON);
if (delimiters != null) {
bitset.or(delimiters);
}
List<String> domains = null;
for (;;) {
this.parser.skipAllWhiteSpace(buf, cursor);
if (cursor.atEnd()) {
break;
}
int pos = cursor.getPos();
int current = (char) (buf.byteAt(pos) & 0xff);
if (current == AT) {
cursor.updatePos(pos + 1);
} else {
break;
}
String s = parseDomain(buf, cursor, bitset);
if (s != null && s.length() > 0) {
if (domains == null) {
domains = new ArrayList<String>();
}
domains.add(s);
}
if (cursor.atEnd()) {
break;
}
pos = cursor.getPos();
current = (char) (buf.byteAt(pos) & 0xff);
if (current == COMMA) {
cursor.updatePos(pos + 1);
} else if (current == COLON) {
cursor.updatePos(pos + 1);
break;
} else {
break;
}
}
return domains != null ? new DomainList(domains) : null;
}