Code example for PipedOutputStream

Methods: flush, write

0
        } 
    } 
 
 
    public void test_writeI() throws IOException { 
        out = new PipedOutputStream();
 
        try { 
            out.write(42);
            fail("Test 1: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
 
        rt = new Thread(reader = new PReader(out));
        rt.start();
        out.write('c');
        out.flush();
        assertEquals("Test 2: The byte read does not match the byte written. ",
                     "c", reader.read(1));
 
/* Test disabled due to incomplete implementation, see ticket #92. 
        rt.interrupt(); 
 
        try { 
            out.write(42); 
            fail("Test 3: IOException expected."); 
        } catch (IOException e) { 
            // Expected. 
        } 
    } 
*/ 
        reader.getReader().close();
        try { 
            out.write(42);
            fail("Test 4: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    }