Code example for PushbackInputStream

Methods: read

0
 
    public void test_read$BII_Exception() throws IOException { 
        PushbackInputStream tobj;
        byte[] buf = new byte[10];
 
        tobj = new PushbackInputStream(underlying);
        try { 
            tobj.read(buf, -1, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            tobj.read(buf, 0, -1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
        try { 
            tobj.read(buf, 10, 1);
            fail("IndexOutOfBoundsException was not thrown");
        } catch (IndexOutOfBoundsException e) {
            // Expected 
        } 
    }