Code example for CharArrayReader

Methods: closereadskip

0
        } 
    } 
 
    public void test_skipJ() throws IOException { 
        long skipped = 0;
        cr = new CharArrayReader(hw);
        skipped = cr.skip(5L);
        assertEquals("Test 1: Failed to skip correct number of chars;",
                5L, skipped);
        assertEquals("Test 2: Skip skipped wrong chars;",
                'W', cr.read());
 
        cr.close();
        try { 
            cr.skip(1);
            fail("Test 3: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    }