319
320
321 private void parse() throws InvalidNameException {
322 rdns = (new DnParser(unparsed, valuesCaseSensitive)).getDn();
323 }
324
325 /*
326 * Best guess as to what RFC 2253 means by "whitespace".
327 */
328 private static boolean isWhitespace(char c) {
329 return (c == ' ' || c == '\r');
330 }
331
332 /**
333 * Given the value of an attribute, returns a string suitable
334 * for inclusion in a DN. If the value is a string, this is
335 * accomplished by using backslash (\) to escape the following
336 * characters:
337 *<ul>
338 *<li>leading and trailing whitespace
339 *<li><pre>, = + < > # ; " \</pre>
340 *</ul>
341 * If the value is a byte array, it is converted to hex
342 * notation (such as "#CEB1DF80").
343 */
344 public static String escapeAttributeValue(Object val) {
345 return TypeAndValue.escapeValue(val);
346 }
347
348 /**
349 * Given an attribute value formatted according to RFC 2253,
350 * returns the unformatted value. Returns a string value as
351 * a string, and a binary value as a byte array.
352 */
353 public static Object unescapeAttributeValue(String val) {
354 return TypeAndValue.unescapeValue(val);
355 }
356
357 /**
358 * Serializes only the unparsed DN, for compactness and to avoid
359 * any implementation dependency.
|
319
320
321 private void parse() throws InvalidNameException {
322 rdns = (new DnParser(unparsed, valuesCaseSensitive)).getDn();
323 }
324
325 /*
326 * Best guess as to what RFC 2253 means by "whitespace".
327 */
328 private static boolean isWhitespace(char c) {
329 return (c == ' ' || c == '\r');
330 }
331
332 /**
333 * Given the value of an attribute, returns a string suitable
334 * for inclusion in a DN. If the value is a string, this is
335 * accomplished by using backslash (\) to escape the following
336 * characters:
337 *<ul>
338 *<li>leading and trailing whitespace
339 *<li><pre>{@literal , = + < > # ; " \}</pre>
340 *</ul>
341 * If the value is a byte array, it is converted to hex
342 * notation (such as "#CEB1DF80").
343 */
344 public static String escapeAttributeValue(Object val) {
345 return TypeAndValue.escapeValue(val);
346 }
347
348 /**
349 * Given an attribute value formatted according to RFC 2253,
350 * returns the unformatted value. Returns a string value as
351 * a string, and a binary value as a byte array.
352 */
353 public static Object unescapeAttributeValue(String val) {
354 return TypeAndValue.unescapeValue(val);
355 }
356
357 /**
358 * Serializes only the unparsed DN, for compactness and to avoid
359 * any implementation dependency.
|