mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-24 23:16:48 +00:00
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user