/** java.io.PipedOutputStream#flush() */ public void test_flush() throws IOException, UnsupportedEncodingException { out = new PipedOutputStream(); rt = new Thread(reader = new PReader(out)); rt.start(); out.write("HelloWorld".getBytes("UTF-8"), 0, 10); assertTrue("Bytes written before flush", reader.available() != 0); out.flush(); assertEquals("Wrote incorrect bytes", "HelloWorld", reader.read(10)); }
/** java.io.PipedOutputStream#write(int) */ public void test_writeI() throws IOException { out = new PipedOutputStream(); rt = new Thread(reader = new PReader(out)); rt.start(); out.write('c'); out.flush(); assertEquals("Wrote incorrect byte", "c", reader.read(1)); }