String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
ByteArrayOutputStream aa = new ByteArrayOutputStream();
OutputStreamWriter a = new OutputStreamWriter(aa, "ISO8859_1");
try {
a.write(str, 0, 4);
a.write('A");
// We have to flush the OutputStreamWriter to guarantee
// that the results will appear in the underlying OutputStream
a.flush();
assertEquals("ISO8859_1", a.getEncoding());
assertEquals(5, aa.size());
assertEquals("AbCdA", aa.toString());
} finally {
a.close();
}