use of org.apache.jena.atlas.io.PeekReader in project jena by apache.
the class AbstractTestPeekReader method read9.
@Test
public void read9() {
PeekReader r = make("a\nb\n");
checkLineCol(r, INIT_LINE, INIT_COL);
int x = r.peekChar();
assertEquals('a', x);
checkLineCol(r, INIT_LINE, INIT_COL);
x = r.readChar();
assertEquals('a', x);
checkLineCol(r, INIT_LINE, INIT_COL + 1);
x = r.readChar();
assertEquals('\n', x);
checkLineCol(r, INIT_LINE + 1, INIT_COL);
}
use of org.apache.jena.atlas.io.PeekReader in project jena by apache.
the class AbstractTestPeekReader method read1.
@Test
public void read1() {
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);
}
use of org.apache.jena.atlas.io.PeekReader in project jena by apache.
the class AbstractTestPeekReader method unread4.
@Test
public void unread4() {
PeekReader r = make("");
r.readChar();
assertEquals(-1, r.peekChar());
r.pushbackChar('0');
r.pushbackChar('1');
r.pushbackChar('2');
r.pushbackChar('3');
// Backwards!
contains(r, "3210");
}
use of org.apache.jena.atlas.io.PeekReader in project jena by apache.
the class AbstractTestPeekReader method unread3.
@Test
public void unread3() {
PeekReader r = make("");
r.readChar();
assertEquals(-1, r.peekChar());
r.pushbackChar('a');
contains(r, "a");
}
use of org.apache.jena.atlas.io.PeekReader in project jena by apache.
the class AbstractTestPeekReader method unread2.
@Test
public void unread2() {
PeekReader r = make("abc");
checkLineCol(r, INIT_LINE, INIT_COL);
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');
checkLineCol(r, INIT_LINE, INIT_COL + 1);
contains(r, "abc");
}
Aggregations