mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-11 12:35:07 +00:00
formatting/ws
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1139924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da62188954
commit
9036626a13
@ -85,14 +85,14 @@ public final void translate(CharSequence input, Writer out) throws IOException {
|
|||||||
// consumed is the number of codepoints consumed
|
// consumed is the number of codepoints consumed
|
||||||
int consumed = translate(input, i, out);
|
int consumed = translate(input, i, out);
|
||||||
|
|
||||||
if(consumed == 0) {
|
if (consumed == 0) {
|
||||||
out.write( Character.toChars( Character.codePointAt(input, i) ) );
|
out.write(Character.toChars(Character.codePointAt(input, i)));
|
||||||
} else {
|
} else {
|
||||||
// contract with translators is that they have to understand codepoints
|
// contract with translators is that they have to understand codepoints
|
||||||
// and they just took care of a surrogate pair
|
// and they just took care of a surrogate pair
|
||||||
for(int j=0; j<consumed; j++) {
|
for (int j = 0; j < consumed; j++) {
|
||||||
if(i < sz - 2) {
|
if (i < sz - 2) {
|
||||||
i += Character.charCount( Character.codePointAt(input, i) );
|
i += Character.charCount(Character.codePointAt(input, i));
|
||||||
} else {
|
} else {
|
||||||
// If the String ends with a high surrogate, just add the 1 and don't worry about such things
|
// If the String ends with a high surrogate, just add the 1 and don't worry about such things
|
||||||
i++;
|
i++;
|
||||||
|
@ -36,7 +36,7 @@ public abstract class CodePointTranslator extends CharSequenceTranslator {
|
|||||||
public final int translate(CharSequence input, int index, Writer out) throws IOException {
|
public final int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||||
int codepoint = Character.codePointAt(input, index);
|
int codepoint = Character.codePointAt(input, index);
|
||||||
boolean consumed = translate(codepoint, out);
|
boolean consumed = translate(codepoint, out);
|
||||||
if(consumed) {
|
if (consumed) {
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user