Code example for PipedOutputStream

Methods: flush, write

0
 
    /** 
     * @tests java.io.PipedOutputStream#write(int) 
     */ 
    public void test_writeI() throws IOException { 
        out = new PipedOutputStream();
        rt = new Thread(reader = new PReader(out));
        rt.start();
        out.write('c');
        out.flush();
        assertEquals("Wrote incorrect byte", "c", reader.read(1));
    } 
 
    /** 
     * Tears down the fixture, for example, close a network connection. This 
     * method is called after a test is executed. 
     */ 
    @Override 
    protected void tearDown() { 
        if (rt != null) {
            rt.interrupt();