Code example for LineNumberInputStream

Methods: close, read

0
        } 
    } 
 
    public void test_read() throws IOException { 
        assertEquals("Test 1: Failed to read correct byte;",
                '0', lnis.read());
        assertEquals("Test 2: Failed to read correct byte on dos text;",
                '0', lnis2.read());
        assertEquals("Test 3: Failed to read correct byte on dos text;",
                '\n', lnis2.read());
        assertEquals("Test 4: Failed to read correct byte on dos text;",
                '1', lnis2.read());
        assertEquals("Test 5: Failed to read correct byte on dos text;",
                '\n', lnis2.read());
        assertEquals("Test 6: Failed to read correct byte on dos text;",
                '2', lnis2.read());
 
        lnis.close();
        try { 
            lnis.read();
            fail("Test 7: IOException expected.");
        } catch (IOException e) {
            // Expected. 
        } 
    }