Code example for LineNumberInputStream

Methods: getLineNumber, mark, read, reset, skip

0
 
    /** 
     * @tests java.io.LineNumberInputStream#reset() 
     */ 
    public void test_reset() throws IOException { 
        lnis.mark(40);
        lnis.skip(4);
        lnis.reset();
        assertEquals("Failed to reset", 0, lnis.getLineNumber());
        assertEquals("Failed to reset", '0', lnis.read());
        lnis.reset();
 
        // see comment for setup 
        try { 
            lnis.mark(5);
            lnis.skip(100);
            lnis.reset();
            fail("Failed to invalidate mark");
        } catch (IOException e) {
            // Correct mark has been invalidated 
            // Expected 
        }