Package org.apache.jena.atlas.io

Examples of org.apache.jena.atlas.io.PeekInputStream.peekByte()


       
        checkLineCol(in, lineNum, colNum) // Unmoved.
        in.pushbackByte('2') ;
        in.pushbackByte('3') ;
        checkLineCol(in, lineNum, colNum) // Unmoved.
        assertEquals('3', in.peekByte()) ;
        contains(in, "320") ;
    }

    private void checkLineCol(PeekInputStream in, long lineNum, long colNum)
    {
View Full Code Here


    @Test public void read1()
    {
        PeekInputStream in = make("") ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
       
        int x = in.peekByte() ;
        assertEquals(-1, x) ;
        x = in.readByte() ;
        assertEquals(-1, x) ;
        x = in.readByte() ;
        assertEquals(-1, x) ;
View Full Code Here

    {
        // Assumes we start at (1,1)
        PeekInputStream in = make("a") ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
       
        int x = in.peekByte() ;
        assertEquals('a', x) ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
       
        x = in.readByte() ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;
View Full Code Here

       
        x = in.readByte() ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;
        assertEquals('a', x) ;
       
        x = in.peekByte() ;
        assertEquals(-1, x) ;
       
        x = in.readByte() ;
        assertEquals(-1, x) ;
    }
View Full Code Here

    @Test public void read9()
    {
        PeekInputStream in = make("a\nb\n") ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
        int x = in.peekByte() ;
        assertEquals('a', x) ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
       
        x = in.readByte() ;
        assertEquals('a', x) ;
View Full Code Here

    }
   
    @Test public void unread1()
    {
        PeekInputStream in = make("abc") ;
        assertEquals('a', in.peekByte()) ;
        in.pushbackByte('Z') ;
        assertEquals('Z', in.peekByte()) ;
        contains(in, "Zabc") ;
    }
View Full Code Here

    @Test public void unread1()
    {
        PeekInputStream in = make("abc") ;
        assertEquals('a', in.peekByte()) ;
        in.pushbackByte('Z') ;
        assertEquals('Z', in.peekByte()) ;
        contains(in, "Zabc") ;
    }

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

        PeekInputStream in = make("abc") ;
        checkLineCol(in, INIT_LINE, INIT_COL) ;
        int ch = in.readByte() ;
        // Pushback does not move line/col backwards.
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;
        assertEquals('b', in.peekByte()) ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;
        in.pushbackByte('a') ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;
        contains(in, "abc") ;
    }
View Full Code Here

   
    @Test public void unread3()
    {
        PeekInputStream in = make("") ;
        int ch = in.readByte() ;
        assertEquals(-1, in.peekByte()) ;
        in.pushbackByte('a') ;
        contains(in, "a") ;
    }

    @Test public void unread4()
View Full Code Here

    @Test public void unread4()
    {
        PeekInputStream in = make("") ;
        int ch = in.readByte() ;
        assertEquals(-1, in.peekByte()) ;
        in.pushbackByte('0') ;
        in.pushbackByte('1') ;
        in.pushbackByte('2') ;
        in.pushbackByte('3') ;
        contains(in, "3210") ;   // Backwards!
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.