* @tests DeflaterInputStream#read(byte[],int,int)
*/
public void testReadByteArrayIntInt() throws IOException {
byte[] buf1 = new byte[256];
byte[] buf2 = new byte[256];
DeflaterInputStream dis = new DeflaterInputStream(is);
assertEquals(23, dis.read(buf1, 0, 256));
dis = new DeflaterInputStream(is);
assertEquals(8, dis.read(buf2, 0, 256));
is = new ByteArrayInputStream(testStr.getBytes("UTF-8"));
dis = new DeflaterInputStream(is);
assertEquals(1, dis.available());
assertEquals(120, dis.read());
assertEquals(1, dis.available());
assertEquals(22, dis.read(buf2, 0, 256));
assertEquals(1, dis.available());
assertEquals(-1, dis.read());
assertEquals(0, dis.available());
try {
dis.read(buf1, 0, 512);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
dis.read(null, 0, 0);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
try {
dis.read(null, -1, 0);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
try {
dis.read(null, -1, -1);
fail("should throw NullPointerException");
} catch (NullPointerException e) {
// expected
}
try {
dis.read(buf1, -1, -1);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
try {
dis.read(buf1, 0, -1);
fail("should throw IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
dis.close();
try {
dis.read(buf1, 0, 512);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(buf1, 0, 1);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(null, 0, 0);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(null, -1, 0);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(null, -1, -1);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(buf1, -1, -1);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
try {
dis.read(buf1, 0, -1);
fail("should throw IOException");
} catch (IOException e) {
// expected
}
}