432433434435436437438439440441442
for (k = 0; k < 8; k++) { i.setBitOffset(k); res[k] = i.readBits(8); i.seek(0); } i.seek(0); h.check(Arrays.equals(res, new long[] { 162, 68, 136, 16, 32, 64, 128, 1 }));
434435436437438439440441442443444
{ i.setBitOffset(k); res[k] = i.readBits(8); i.seek(0); } i.seek(0); h.check(Arrays.equals(res, new long[] { 162, 68, 136, 16, 32, 64, 128, 1 })); // 64 bytes of data. b = new byte[]
465466467468469470471472473474475
bs = new ByteArrayInputStream(b); i = new MemoryCacheImageInputStream(bs); // Test mark() and reset(). i.seek(17); h.check(i.getStreamPosition() == 17); i.mark(); i.seek(49); h.check(i.getStreamPosition() == 49); i.reset();
468469470471472473474475476477478
// Test mark() and reset(). i.seek(17); h.check(i.getStreamPosition() == 17); i.mark(); i.seek(49); h.check(i.getStreamPosition() == 49); i.reset(); h.check(i.getStreamPosition() == 17); // Test skipBytes().
480481482483484485486487488489490
i.skipBytes(20); h.check(i.getStreamPosition() == 37); h.check(i.getBitOffset() == 0); // Test readUTF(). i.seek(12); String str = i.readUTF(); h.check(str.codePointAt(0) == 18); h.check(str.codePointAt(1) == 33); b = new byte[]
533534535536537538539540541542543
bs = new ByteArrayInputStream(b); i = new MemoryCacheImageInputStream(bs); byte[] fullB = new byte[26]; i.seek(0); i.readFully(fullB); h.check(Arrays.equals(fullB, new byte[] { (byte) 0x92, (byte) 0x80, (byte) 0x05, (byte) 0x77,
550551552553554555556557558559560
})); for (k = 0; k < fullB.length; k++) fullB[k] = 0; i.seek(0); i.readFully(fullB, 5, 13); h.check(Arrays.equals(fullB, new byte[] { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00,
565566567568569570571572573574575
(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 })); char[] fullC = new char[15]; i.seek(0); i.readFully(fullC, 0, 15); h.check(Arrays.equals(fullC, new char[] { (char) 37504, (char) 1399, (char) 44274,
578579580581582583584585586587588
(char) 33280, (char) 37504, (char) 1399, (char) 44274, (char) 35751, (char) 23760 })); double[] fullD = new double[8]; i.seek(0); i.readFully(fullD, 0, 8); h.check(Arrays.equals(fullD, new double[] { -1.4183142849706364E-219, 1.2402952421911034E139,
593594595596597598599600601602603
1.2402952421911034E139, -3.154063812740471E-145 })); float[] fullF = new float[16]; i.seek(0); i.readFully(fullF, 0, 16); h.check(Arrays.equals(fullF, new float[] { -8.079283E-28f, -6.893558E-12f,