Search in sources :

Example 16 with PeekReader

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

the class JSONParser method parseAny.

/** Parse to get a Json primitive */
public static void parseAny(InputStream input, JSONHandler handler) {
    PeekReader r = PeekReader.makeUTF8(input);
    TokenizerJSON t = new TokenizerJSON(r);
    parseAny(t, handler);
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Example 17 with PeekReader

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

the class JSONParser method parse.

/** Parse to get a Json object */
public static void parse(Reader reader, JSONHandler handler) {
    PeekReader r = PeekReader.make(reader);
    TokenizerJSON t = new TokenizerJSON(r);
    parse(t, handler);
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Example 18 with PeekReader

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

the class JSONParser method parseAny.

/** Parse to get a Json primitive */
public static void parseAny(Reader reader, JSONHandler handler) {
    PeekReader r = PeekReader.make(reader);
    TokenizerJSON t = new TokenizerJSON(r);
    parseAny(t, handler);
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader)

Example 19 with PeekReader

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

the class Token method create.

static Token create(String s) {
    PeekReader pr = PeekReader.readString(s);
    TokenizerText tt = new TokenizerText(pr);
    if (!tt.hasNext())
        throw new RiotException("No token");
    Token t = tt.next();
    if (tt.hasNext())
        throw new RiotException("Extraneous charcaters");
    return t;
}
Also used : PeekReader(org.apache.jena.atlas.io.PeekReader) RiotException(org.apache.jena.riot.RiotException)

Example 20 with PeekReader

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

the class TokenizerFactory method makeTokenizerUTF8.

public static Tokenizer makeTokenizerUTF8(InputStream in) {
    // BOM will be removed
    PeekReader peekReader = PeekReader.makeUTF8(in);
    Tokenizer tokenizer = new TokenizerText(peekReader);
    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