Code example for PipedWriter

Methods: closewrite

0
    public void test_close() throws Exception { 
        // Test for method void java.io.PipedWriter.close() 
        char[] buf = new char[10];
        "HelloWorld".getChars(0, 10, buf, 0);
        PipedReader rd = new PipedReader();
        pw = new PipedWriter(rd);
        reader = new PReader(rd);
        pw.close();
        try { 
            pw.write(buf);
            fail("Should have thrown exception when attempting to write to closed writer.");
        } catch (Exception e) {
            // correct 
        } 
    } 
 
    /** 
     * @tests java.io.PipedWriter#connect(java.io.PipedReader) 
     */ 
    public void test_connectLjava_io_PipedReader() throws Exception { 
Experience pair programming with AI  Get Codota for Java