Code example for PipedInputStream

Methods: read

0
            obj.read(new byte[0], -1, -1);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
    } 
 
    /** 
     * @tests java.io.PipedInputStream#receive(int) 
     */ 
    public void test_receive() throws IOException { 
        pis = new PipedInputStream();
        pos = new PipedOutputStream();
 
        // test if writer recognizes dead reader 
        pis.connect(pos);
        class WriteRunnable implements Runnable {
 
            boolean pass = false;
 
            volatile boolean readerAlive = true;