mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-06 10:08:32 +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
|
||||
int consumed = translate(input, i, out);
|
||||
|
||||
if(consumed == 0) {
|
||||
out.write( Character.toChars( Character.codePointAt(input, i) ) );
|
||||
if (consumed == 0) {
|
||||
out.write(Character.toChars(Character.codePointAt(input, i)));
|
||||
} else {
|
||||
// contract with translators is that they have to understand codepoints
|
||||
// and they just took care of a surrogate pair
|
||||
for(int j=0; j<consumed; j++) {
|
||||
if(i < sz - 2) {
|
||||
i += Character.charCount( Character.codePointAt(input, i) );
|
||||
for (int j = 0; j < consumed; j++) {
|
||||
if (i < sz - 2) {
|
||||
i += Character.charCount(Character.codePointAt(input, i));
|
||||
} else {
|
||||
// If the String ends with a high surrogate, just add the 1 and don't worry about such things
|
||||
i++;
|
||||
|
@ -36,7 +36,7 @@ public abstract class CodePointTranslator extends CharSequenceTranslator {
|
||||
public final int translate(CharSequence input, int index, Writer out) throws IOException {
|
||||
int codepoint = Character.codePointAt(input, index);
|
||||
boolean consumed = translate(codepoint, out);
|
||||
if(consumed) {
|
||||
if (consumed) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user