Code example for PushbackReader

Methods: closeread

0
			fail("IOException during read test : " + e.getMessage());
		} 
	} 
 
    public void test_read_$CII_Exception() throws IOException { 
        pbr = new PushbackReader(new StringReader(pbString), 10);
 
        char[] charArray = new char[10];
 
        try { 
            pbr.read(null, 1, 0);
            fail();
        } catch (NullPointerException expected) {
        } 
        try { 
            pbr.read(charArray, 0, -1);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
        try { 
            pbr.read(charArray, -1, 0);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
 
        pbr.read(charArray, 0, 0);
        pbr.read(charArray, 0, charArray.length);
        pbr.read(charArray, charArray.length, 0);
 
        try { 
            pbr.read(charArray, charArray.length + 1, 0);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
        try { 
            pbr.read(charArray, 0, charArray.length + 1);
            fail();
        } catch (IndexOutOfBoundsException expected) {
        } 
 
        // Can't read from a closed PushbackReader. 
        pbr.close();
        try { 
            pbr.read(charArray, 0, 1);
            fail();
        } catch (IOException expected) {
        } 
    } 
 
Contextual code suggestions in your IDE  Get Codota for Java