563 * the same key iff they are equal, taking possible case-folding
564 * into account. See compareLabels().
565 */
566 private static String keyForLabel(String label) {
567 StringBuilder sb = new StringBuilder(label.length());
568 for (int i = 0; i < label.length(); i++) {
569 char c = label.charAt(i);
570 if (c >= 'A' && c <= 'Z') {
571 c += 'a' - 'A'; // to lower case
572 }
573 sb.append(c);
574 }
575 return sb.toString();
576 }
577
578
579 /**
580 * Serializes only the domain name string, for compactness and to avoid
581 * any implementation dependency.
582 *
583 * @serialdata The domain name string.
584 */
585 private void writeObject(java.io.ObjectOutputStream s)
586 throws java.io.IOException {
587 s.writeObject(toString());
588 }
589
590 private void readObject(java.io.ObjectInputStream s)
591 throws java.io.IOException, ClassNotFoundException {
592 try {
593 parse((String) s.readObject());
594 } catch (InvalidNameException e) {
595 // shouldn't happen
596 throw new java.io.StreamCorruptedException(
597 "Invalid name: " + domain);
598 }
599 }
600
601 private static final long serialVersionUID = 7040187611324710271L;
602 }
|
563 * the same key iff they are equal, taking possible case-folding
564 * into account. See compareLabels().
565 */
566 private static String keyForLabel(String label) {
567 StringBuilder sb = new StringBuilder(label.length());
568 for (int i = 0; i < label.length(); i++) {
569 char c = label.charAt(i);
570 if (c >= 'A' && c <= 'Z') {
571 c += 'a' - 'A'; // to lower case
572 }
573 sb.append(c);
574 }
575 return sb.toString();
576 }
577
578
579 /**
580 * Serializes only the domain name string, for compactness and to avoid
581 * any implementation dependency.
582 *
583 * @serialData The domain name string.
584 */
585 private void writeObject(java.io.ObjectOutputStream s)
586 throws java.io.IOException {
587 s.writeObject(toString());
588 }
589
590 private void readObject(java.io.ObjectInputStream s)
591 throws java.io.IOException, ClassNotFoundException {
592 try {
593 parse((String) s.readObject());
594 } catch (InvalidNameException e) {
595 // shouldn't happen
596 throw new java.io.StreamCorruptedException(
597 "Invalid name: " + domain);
598 }
599 }
600
601 private static final long serialVersionUID = 7040187611324710271L;
602 }
|