Package org.apache.jena.atlas.io

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


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


        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

       
        int x = in.peekByte() ;
        assertEquals(-1, x) ;
        x = in.readByte() ;
        assertEquals(-1, x) ;
        x = in.readByte() ;
        assertEquals(-1, x) ;
    }
   
    @Test public void read2()
    {
View Full Code Here

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

        assertEquals('a', x) ;
       
        x = in.peekByte() ;
        assertEquals(-1, x) ;
       
        x = in.readByte() ;
        assertEquals(-1, x) ;
    }

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

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

    @Test public void read4()
View Full Code Here

        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) ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;

        x = in.readByte() ;
        assertEquals('\n', x) ;
View Full Code Here

       
        x = in.readByte() ;
        assertEquals('a', x) ;
        checkLineCol(in, INIT_LINE, INIT_COL+1) ;

        x = in.readByte() ;
        assertEquals('\n', x) ;
        checkLineCol(in, INIT_LINE+1, INIT_COL) ;
    }
   
    @Test public void unread1()
View Full Code Here

    @Test public void unread2()
    {
        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') ;
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") ;
    }
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.