Search in sources :

Example 6 with PeekReader

use of org.apache.jena.atlas.io.PeekReader in project jena by apache.

the class AbstractTestPeekReader method unread5.

@Test
public void unread5() {
    PeekReader r = make("");
    long lineNum = r.getLineNum();
    long colNum = r.getColNum();
    checkLineCol(r, lineNum, colNum);
    r.pushbackChar('0');
    // Unmoved.
    checkLineCol(r, lineNum, colNum);
    r.pushbackChar('1');
    checkLineCol(r, lineNum, colNum);
    assertEquals('1', r.readChar());
    // Unmoved.
    checkLineCol(r, lineNum, colNum);
    r.pushbackChar('2');
    r.pushbackChar('3');
    // Unmoved.
    checkLineCol(r, lineNum, colNum);
    assertEquals('3', r.peekChar());
    contains(r, "320");
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader) BaseTest(org.apache.jena.atlas.junit.BaseTest) Test(org.junit.Test)

Example 7 with PeekReader

use of org.apache.jena.atlas.io.PeekReader in project jena by apache.

the class TokenizerFactory method makeTokenizer.

/** Discouraged - be careful about character sets */
@Deprecated
public static Tokenizer makeTokenizer(Reader reader) {
    PeekReader peekReader = PeekReader.make(reader);
    Tokenizer tokenizer = new TokenizerText(peekReader);
    return tokenizer;
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Example 8 with PeekReader

use of org.apache.jena.atlas.io.PeekReader in project jena by apache.

the class Token method createN.

static Iter<Token> createN(String s) {
    PeekReader pr = PeekReader.readString(s);
    TokenizerText tt = new TokenizerText(pr);
    List<Token> x = new ArrayList<>();
    while (tt.hasNext()) x.add(tt.next());
    return Iter.iter(x);
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader) ArrayList(java.util.ArrayList)

Example 9 with PeekReader

use of org.apache.jena.atlas.io.PeekReader in project jena by apache.

the class TokenizerFactory method makeTokenizerASCII.

public static Tokenizer makeTokenizerASCII(InputStream in) {
    PeekReader peekReader = PeekReader.makeASCII(in);
    Tokenizer tokenizer = new TokenizerText(peekReader);
    return tokenizer;
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Example 10 with PeekReader

use of org.apache.jena.atlas.io.PeekReader in project jena by apache.

the class TestTokenizer method tokenizer.

private static Tokenizer tokenizer(String string, boolean lineMode) {
    PeekReader r = PeekReader.readString(string);
    Tokenizer tokenizer = new TokenizerText(r, lineMode);
    return tokenizer;
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Aggregations

PeekReader (org.apache.jena.atlas.io.PeekReader)22 BaseTest (org.apache.jena.atlas.junit.BaseTest)9 Test (org.junit.Test)9 ArrayList (java.util.ArrayList)1 RiotException (org.apache.jena.riot.RiotException)1