Code example for PipedWriter

Methods: flush, write

0
        } 
    } 
 
    public void test_flush() throws Exception { 
        // Test for method void java.io.PipedWriter.flush() 
        pw = new PipedWriter();
        readerThread = new Thread(reader = new PReader(pw), "flush");
        readerThread.start();
        pw.write(testBuf);
        pw.flush();
        assertEquals("Test 1: Flush failed. ", testString,
                reader.read(testLength));
    } 
 
    public void test_write$CII() throws Exception { 
        pw = new PipedWriter();
 
        try { 
            pw.write(testBuf, 0, 5);
            fail("Test 1: IOException expected.");
        } catch (IOException e) {