public String collectWhileNotIn(CharSet... charSets) throws IOException { sb.setLength(0); while (!nextChar().in(charSets)) { sb.append((char) ch); } pushback(); return sb.toString(); }
public String collectWhileIn(CharSet... charSets) throws IOException { sb.setLength(0); while (nextChar().in(charSets)) { sb.append((char) ch); } pushback(); return sb.toString(); }
private void expect(CharSet charSet) throws IOException { if (nextChar().notIn(charSet)) { throw new IOException("Expected " + charSet + " found " + location()); } }
private boolean skipWhileIn(CharSet... charSets) throws IOException { boolean found = false; while (nextChar().in(charSets)) { found = true; } pushback(); return found; }
private void skipWhitespace() throws IOException { while (nextChar().in(WS)) ; // NOSONAR pushback(); }
private UpdateClause load() throws IOException { // LOAD <remoteURI> [ INTO <uri> ] UID remoteURI = uri(); nextChar(); if (ch > -1) { skipWhileIn(WS, INTO); UID into = uri(); return new UpdateClause(prefixes, UpdateClause.Type.LOAD, remoteURI, into); } else { return new UpdateClause(prefixes, UpdateClause.Type.LOAD, remoteURI); } }
private UpdateClause clear() throws IOException { // CLEAR [ GRAPH <uri> ] skipWhitespace(); nextChar(); if (ch > -1 && ch < 65535) { // FIXME skipWhileIn(GRAPH, WS); UID uid = uri(); return new UpdateClause(prefixes, UpdateClause.Type.CLEAR, uid); } else { return new UpdateClause(prefixes, UpdateClause.Type.CLEAR); } }
this.in = new PushbackReader(new InputStreamReader(in, charset), 1); init(); while (nextChar().in(P)) { skipWhileIn(PREFIX, WS); String prefix = collectWhileIn(WORD);
private UpdateClause modify() throws IOException { // MODIFY [ <uri> ]* DELETE { template } INSERT { template } [ WHERE { // pattern } ] UpdateClause modify = new UpdateClause(prefixes, UpdateClause.Type.MODIFY); nextChar(); while (in(LT)) { pushback(); modify.addInto(uri()); skipWhitespace(); nextChar(); } skipWhileIn(DELETE, WS); modify.setDelete(block()); skipWhileIn(INSERT, WS); modify.setInsert(block()); skipWhitespace(); nextChar(); if (ch > -1 && ch < 65535) { // FIXME skipWhileIn(WHERE, WS); modify.setPattern(block()); } return modify; }
private UpdateClause insert() throws IOException { // INSERT DATA [ INTO <uri> ]* { triples } // INSERT [ INTO <uri> ]* { template } [ WHERE { pattern } ] String token = collectWhileIn(DATA, INTO); UpdateClause insert = new UpdateClause(prefixes, UpdateClause.Type.INSERT); if (token.equals("DATA")) { insert.addInto(into()); insert.setTemplate(block()); } else { if (token.equals("INTO")) { skipWhitespace(); insert.addInto(uri()); insert.addInto(into()); skipWhitespace(); } insert.setTemplate(block()); skipWhileIn(WS); if (nextChar().in(WHERE)) { skipWhileIn(WS, WHERE); insert.setPattern(block()); } } return insert; }