Code example for LineNumberInputStream

Methods: closegetLineNumbermarkreadresetskip

0
            // Expected. 
        } 
    } 
 
    public void test_reset() throws IOException { 
        lnis.mark(40);
        lnis.skip(4);
        lnis.reset();
        assertEquals("Test 1: Failed to reset", 0, lnis.getLineNumber());
        assertEquals("Test 2: Failed to reset", '0', lnis.read());
        lnis.reset();
 
        try { 
            lnis.mark(5);
            lnis.skip(100);
            lnis.reset();
            fail("Test 3: Failed to invalidate mark.");
        } catch (IOException e) {
            // Correct; mark has been invalidated. 
        } 
 
        lnis.mark(5);
        lnis.close();
        try { 
            lnis.reset();
            fail("Test 4: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    } 
Stop searching for code, let great code find you!  Add Codota to your java IDE