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.
360 *
361 * @serialdata The DN string and a boolean indicating whether
362 * the values are case sensitive.
363 */
364 private void writeObject(java.io.ObjectOutputStream s)
365 throws java.io.IOException {
366 s.writeObject(toString());
367 s.writeBoolean(valuesCaseSensitive);
368 }
369
370 private void readObject(java.io.ObjectInputStream s)
371 throws java.io.IOException, ClassNotFoundException {
372 unparsed = (String)s.readObject();
373 valuesCaseSensitive = s.readBoolean();
374 try {
375 parse();
376 } catch (InvalidNameException e) {
377 // shouldn't happen
378 throw new java.io.StreamCorruptedException(
379 "Invalid name: " + unparsed);
380 }
381 }
|
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.
360 *
361 * @serialData The DN string and a boolean indicating whether
362 * the values are case sensitive.
363 */
364 private void writeObject(java.io.ObjectOutputStream s)
365 throws java.io.IOException {
366 s.writeObject(toString());
367 s.writeBoolean(valuesCaseSensitive);
368 }
369
370 private void readObject(java.io.ObjectInputStream s)
371 throws java.io.IOException, ClassNotFoundException {
372 unparsed = (String)s.readObject();
373 valuesCaseSensitive = s.readBoolean();
374 try {
375 parse();
376 } catch (InvalidNameException e) {
377 // shouldn't happen
378 throw new java.io.StreamCorruptedException(
379 "Invalid name: " + unparsed);
380 }
381 }
|