final Reader reader = new Utf8InputStreamReader(new ByteArrayInputStream(baos.toByteArray()));
final char[] actual = new char[10];
try {
assertTrue(reader.ready());
assertEquals(8, reader.read(actual, 0, 8));
assertFalse(reader.ready());
assertEquals(2, reader.read(actual, 8, 8));
assertEquals(-1, reader.read(actual, 10, 8));
assertEquals(-1, reader.read());
assertEquals(-1, reader.read(actual));
assertFalse(reader.ready());