StreamByteBuffer byteBuffer = new StreamByteBuffer(1024, StreamByteBuffer.ReadMode.RETAIN_AFTER_READING);
PrintWriter pw=new PrintWriter(new OutputStreamWriter(byteBuffer.getOutputStream(),"UTF-8"));
pw.print(TEST_STRING);
pw.close();
assertEquals(TEST_STRING, byteBuffer.readAsString("UTF-8"));
byteBuffer.reset();
// call a second time to test if the RETAIN_AFTER_READING mode works as expected
assertEquals(TEST_STRING, byteBuffer.readAsString("UTF-8"));
}
public void testToInputStream() throws IOException {