Package org.apache.jena.atlas.io

Examples of org.apache.jena.atlas.io.PeekReader.readChar()


    @Test public void unread2()
    {
        PeekReader r = make("abc") ;
        checkLineCol(r, INIT_LINE, INIT_COL) ;
        int ch = r.readChar() ;
        // Pushback does not move line/col backwards.
        checkLineCol(r, INIT_LINE, INIT_COL+1) ;
        assertEquals('b', r.peekChar()) ;
        checkLineCol(r, INIT_LINE, INIT_COL+1) ;
        r.pushbackChar('a') ;
View Full Code Here


    }
   
    @Test public void unread3()
    {
        PeekReader r = make("") ;
        int ch = r.readChar() ;
        assertEquals(-1, r.peekChar()) ;
        r.pushbackChar('a') ;
        contains(r, "a") ;
    }
View Full Code Here

    }

    @Test public void unread4()
    {
        PeekReader r = make("") ;
        int ch = r.readChar() ;
        assertEquals(-1, r.peekChar()) ;
        r.pushbackChar('0') ;
        r.pushbackChar('1') ;
        r.pushbackChar('2') ;
        r.pushbackChar('3') ;
View Full Code Here

       
        r.pushbackChar('0') ;
        checkLineCol(r, lineNum, colNum) // Unmoved.
        r.pushbackChar('1') ;
        checkLineCol(r, lineNum, colNum) ;
        assertEquals('1', r.readChar()) ;
       
        checkLineCol(r, lineNum, colNum) // Unmoved.
        r.pushbackChar('2') ;
        r.pushbackChar('3') ;
        checkLineCol(r, lineNum, colNum) // Unmoved.
View Full Code Here

        checkLineCol(r, line, col) ;
        assertEquals(0, r.getPosition()) ;
       
        for ( int i = 0 ; i < contents.length(); i++ )
        {
            int x = r.readChar() ;
            if ( x != -1 )
            {
                if ( x == '\n' )
                {
                    line++ ;
View Full Code Here

        PeekReader r = make("") ;
        checkLineCol(r, INIT_LINE, INIT_COL) ;
       
        int x = r.peekChar() ;
        assertEquals(-1, x) ;
        x = r.readChar() ;
        assertEquals(-1, x) ;
        x = r.readChar() ;
        assertEquals(-1, x) ;
    }
   
View Full Code Here

       
        int x = r.peekChar() ;
        assertEquals(-1, x) ;
        x = r.readChar() ;
        assertEquals(-1, x) ;
        x = r.readChar() ;
        assertEquals(-1, x) ;
    }
   
    @Test public void read2()
    {
View Full Code Here

       
        int x = r.peekChar() ;
        assertEquals('a', x) ;
        checkLineCol(r, INIT_LINE, INIT_COL) ;
       
        x = r.readChar() ;
        checkLineCol(r, INIT_LINE, INIT_COL+1) ;
        assertEquals('a', x) ;
       
        x = r.peekChar() ;
        assertEquals(-1, x) ;
View Full Code Here

        assertEquals('a', x) ;
       
        x = r.peekChar() ;
        assertEquals(-1, x) ;
       
        x = r.readChar() ;
        assertEquals(-1, x) ;
    }

    @Test public void read3()
    {
View Full Code Here

        for ( int i = 0 ; i < c.length(); i++ )
        {
            checkLineCol(r, INIT_LINE, i+INIT_COL) ;
            long z = r.getPosition() ;
            assertEquals(i, r.getPosition()) ;
            assertEquals(c.charAt(i), r.readChar()) ;
        }
        assertTrue(r.eof()) ;
    }

    @Test public void read4()
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.