}
}
}
private void doTestRead(byte[] expectedData, int expectedLen, String id) throws IOException {
InputStream in = new MicroKernelInputStream(mk, id);
Random r = new Random(1);
ByteArrayOutputStream buff = new ByteArrayOutputStream();
int minLen = 0;
if (expectedLen > 1000000) {
minLen = 4000;
}
while (true) {
int op = r.nextInt(3);
if (op == 0) {
int x = in.read();
if (x < 0) {
break;
}
buff.write(x);
} else if (op == 1) {
byte[] x = new byte[minLen + r.nextInt(5000)];
int l = in.read(x);
if (l < 0) {
break;
}
buff.write(x, 0, l);
} else {
int offset = r.nextInt(10);
int len = minLen + r.nextInt(1000);
byte[] x = new byte[offset + len];
int l = in.read(x, offset, len);
if (l < 0) {
break;
}
buff.write(x, offset, l);
}