private boolean in(CharSet... charSets) throws IOException { for (CharSet cs : charSets) { if (in(cs)) { return true; } } return false; }
this.in = new PushbackReader(new InputStreamReader(in, charset), 1); init(); while (nextChar().in(P)) { skipWhileIn(PREFIX, WS); String prefix = collectWhileIn(WORD);
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; }
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 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 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; }