Code example for PipedWriter

Methods: flush, write

0
     */ 
    public void test_flush() throws Exception { 
        // Test for method void java.io.PipedWriter.flush() 
        char[] buf = new char[10];
        "HelloWorld".getChars(0, 10, buf, 0);
        pw = new PipedWriter();
        rdrThread = new Thread(reader = new PReader(pw), "flush");
        rdrThread.start();
        pw.write(buf);
        pw.flush();
        rdrThread.join(700);
        assertEquals("Failed to flush chars", "HelloWorld", new String(
                reader.buf));
    } 
     
    /** 
     * @tests java.io.PipedWriter#flush() 
     * Regression HARMONY-6293 
     */ 
    public void test_flushAfterClose() throws Exception {