}
//-----------------------------------------------------------------------
public void testWrite_byteArrayToWriter_Encoding() throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
YellOnFlushAndCloseOutputStream out = new YellOnFlushAndCloseOutputStream(baout, true, true);
Writer writer = new OutputStreamWriter(baout, "US-ASCII");
IOUtils.write(inData, writer, "UTF8");
out.off();
writer.flush();
byte[] bytes = baout.toByteArray();
bytes = new String(bytes, "UTF8").getBytes("US-ASCII");
assertTrue("Content differs", Arrays.equals(inData, bytes));