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:
Matthew Jason Benson 2011-06-26 19:32:14 +00:00
parent da62188954
commit 9036626a13
2 changed files with 6 additions and 6 deletions

View File

@ -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++;

View File

@ -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;