Issue #45 Unicode character cannot save

Code formatting
This commit is contained in:
Jindra Petk
2013-03-30 16:43:26 +01:00
parent d3bd9b641d
commit be106cc34b
772 changed files with 84378 additions and 84353 deletions

View File

@@ -22,52 +22,52 @@ import java.io.OutputStream;
public class CopyOutputStream extends OutputStream {
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public int ignoreFirst = 0;
private OutputStream os;
private InputStream is;
private long pos = 0;
private int TEMPSIZE = 5;
private int temp[] = new int[TEMPSIZE];
private int tempPos = 0;
public int ignoreFirst = 0;
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
public CopyOutputStream(OutputStream os, InputStream is) {
this.os = os;
this.is = is;
}
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
@Override
public void write(int b) throws IOException {
temp[tempPos] = b;
tempPos = (tempPos + 1) % TEMPSIZE;
pos++;
int r = is.read();
if ((b & 0xff) != r) {
if (ignoreFirst <= 0) {
os.flush();
pos++;
int r = is.read();
if ((b & 0xff) != r) {
if (ignoreFirst <= 0) {
os.flush();
boolean output = true;
boolean output = true;
if (output) {
System.out.println("Position: " + pos);
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
if (output) {
System.out.println("Position: " + pos);
System.out.print("Last written:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.print("" + Integer.toHexString(temp[(tempPos + i) % TEMPSIZE]) + " ");
}
System.out.println("");
System.out.println("More expected:");
for (int i = 0; i < TEMPSIZE; i++) {
System.out.println("" + Integer.toHexString(is.read()));
}
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
System.out.println("");
System.out.println(Integer.toHexString(r) + " expected but " + Integer.toHexString(b) + " found");
}
throw new NotSameException(pos);
} else {
ignoreFirst--;
}
throw new NotSameException(pos);
} else {
ignoreFirst--;
}
}
os.write(b);
}
}
os.write(b);
}
}