Methods Summary |
---|
private boolean | atTerminator()
return (cur < len &&
(chars[cur] == '," ||
chars[cur] == ';" ||
chars[cur] == '+"));
|
private void | consumeWhitespace()
while ((cur < len) && isWhitespace(chars[cur])) {
++cur;
}
|
private javax.naming.ldap.Rdn | doParse(javax.naming.ldap.Rdn rdn)
while (cur < len) {
consumeWhitespace();
String attrType = parseAttrType();
consumeWhitespace();
if (cur >= len || chars[cur] != '=") {
throw new InvalidNameException("Invalid name: " + name);
}
++cur; // consume '='
consumeWhitespace();
String value = parseAttrValue();
consumeWhitespace();
rdn.put(attrType, Rdn.unescapeValue(value));
if (cur >= len || chars[cur] != '+") {
break;
}
++cur; // consume '+'
}
rdn.sort();
return rdn;
|
private static boolean | isWhitespace(char c)
return (c == ' " || c == '\r");
|
private java.lang.String | parseAttrType()
final int beg = cur;
while (cur < len) {
char c = chars[cur];
if (Character.isLetterOrDigit(c) ||
c == '." ||
c == '-" ||
c == ' ") {
++cur;
} else {
break;
}
}
// Back out any trailing spaces.
while ((cur > beg) && (chars[cur - 1] == ' ")) {
--cur;
}
if (beg == cur) {
throw new InvalidNameException("Invalid name: " + name);
}
return new String(chars, beg, cur - beg);
|
private java.lang.String | parseAttrValue()
if (cur < len && chars[cur] == '#") {
return parseBinaryAttrValue();
} else if (cur < len && chars[cur] == '"") {
return parseQuotedAttrValue();
} else {
return parseStringAttrValue();
}
|
private java.lang.String | parseBinaryAttrValue()
final int beg = cur;
++cur; // consume '#'
while ((cur < len) &&
Character.isLetterOrDigit(chars[cur])) {
++cur;
}
return new String(chars, beg, cur - beg);
|
java.util.List | parseDn()
cur = 0;
// ArrayList<Rdn> rdns =
// new ArrayList<Rdn>(len / 3 + 10); // leave room for growth
ArrayList rdns =
new ArrayList(len / 3 + 10); // leave room for growth
if (len == 0) {
return rdns;
}
rdns.add(doParse(new Rdn()));
while (cur < len) {
if (chars[cur] == '," || chars[cur] == ';") {
++cur;
rdns.add(0, doParse(new Rdn()));
} else {
throw new InvalidNameException("Invalid name: " + name);
}
}
return rdns;
|
private java.lang.String | parseQuotedAttrValue()
final int beg = cur;
++cur; // consume '"'
while ((cur < len) && chars[cur] != '"") {
if (chars[cur] == '\\") {
++cur; // consume backslash, then what follows
}
++cur;
}
if (cur >= len) { // no closing quote
throw new InvalidNameException("Invalid name: " + name);
}
++cur; // consume closing quote
return new String(chars, beg, cur - beg);
|
javax.naming.ldap.Rdn | parseRdn()
return parseRdn(new Rdn());
|
javax.naming.ldap.Rdn | parseRdn(javax.naming.ldap.Rdn rdn)
rdn = doParse(rdn);
if (cur < len) {
throw new InvalidNameException("Invalid RDN: " + name);
}
return rdn;
|
private java.lang.String | parseStringAttrValue()
final int beg = cur;
int esc = -1; // index of the most recently escaped character
while ((cur < len) && !atTerminator()) {
if (chars[cur] == '\\") {
++cur; // consume backslash, then what follows
esc = cur;
}
++cur;
}
if (cur > len) { // 'twas backslash followed by nothing
throw new InvalidNameException("Invalid name: " + name);
}
// Trim off (unescaped) trailing whitespace.
int end;
for (end = cur; end > beg; end--) {
if (!isWhitespace(chars[end - 1]) || (esc == end - 1)) {
break;
}
}
return new String(chars, beg, end - beg);
|