Code example for LineNumberReader

Methods: getLineNumber, read

0
 
    /** 
     * @tests java.io.LineNumberReader#read() 
     */ 
    public void test_read() throws IOException { 
        lnr = new LineNumberReader(new StringReader(text));
 
        int c = lnr.read();
        assertEquals("Read returned incorrect character", '0', c);
 
        lnr.read();
        assertEquals("Read failed to inc lineNumber", 1, lnr.getLineNumber());
    } 
 
    /** 
     * @tests java.io.LineNumberReader#read(char[], int, int) 
     */ 
    public void test_read$CII() throws IOException { 
        lnr = new LineNumberReader(new StringReader(text));
        char[] c = new char[100];
        lnr.read(c, 0, 4);