…lines 1–76 unchanged (76 lines)
77 throw new IllegalArgumentException("The Writer must not be null");
78 }
79 if (input == null) {
80 return;
81 }
82 int pos = 0;
83 int len = Character.codePointCount(input, 0, input.length());
84 while (pos < len) {
85 int consumed = translate(input, pos, out);
86 if (consumed == 0) {
87 char[] c = Character.toChars(Character.codePointAt(input, pos));
88 out.write(c);
89 }
90 else {
91// // contract with translators is that they have to understand codepoints
92// // and they just took care of a surrogate pair
93 for (int pt = 0; pt < consumed; pt++) {
94 if (pos < len - 2) {
95 pos += Character.charCount(Character.codePointAt(input, pos));
96 } else {
97 pos++;
98 }
99 }
100 pos--;
101 }
102 pos++;
103 }
104 }
105
106 /**
107 * Helper method to create a merger of this translator with another set of
108 * translators. Useful in customizing the standard functionality.
…lines 109–132 unchanged (24 lines)