This commit is contained in:
Administrator
2022-12-27 17:38:49 +08:00
parent 6dd349e722
commit c791720f95
18 changed files with 292 additions and 67 deletions
+42
View File
@@ -0,0 +1,42 @@
package org.kne.io;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
public final class AddInputStream extends InputStream {
volatile byte out = 0;
private InputStream in;
@Override
public int read() throws IOException {
int read = in.read();
if (read==-1) {
return -1;
}
out = (byte) (out+(byte) read);
return out&0xff;
}
@Override
public void close() throws IOException {
in.close();
}
public AddInputStream(InputStream in) {
super();
this.in = in;
}
public void read(byte[][] e) throws IOException {
for (int y = 0; y<e.length; y++) {
byte tmp[] = e[y];
for (int x = 0; x<tmp.length; x++) {
tmp[x] = (byte) read();
}
}
}
}