Code example for PipedWriter

Methods: close, write

0
 
    public void test_ConstructorLjava_io_PipedReader() throws Exception { 
        PipedReader rd = new PipedReader();
 
        try { 
            pw = new PipedWriter(rd);
        } catch (Exception e) {
            fail("Test 1: Construtor failed:" + e.getMessage());
        } 
 
        readerThread = new Thread(reader = new PReader(rd), "Constructor(Reader)");
        readerThread.start();
        try { 
            pw.write(testBuf);
        } catch (Exception e) {
            fail("Test 2: Could not write to the constructed writer: "
                    + e.getMessage());
        } 
        pw.close();
        assertEquals("Test 3: Incorrect character string received.", testString,
                reader.read(testLength));
 
        rd = new PipedReader(new PipedWriter());
        try {