public Iterator<Node[]> parse(BufferedReader br) { return parse(stringItFromBufferedReader(br)); }
public Iterator<Node[]> parse(Iterator<String> iterator) { _stringIt = iterator; loadNext(); return this; }
public Iterator<Node[]> parse(Reader r) { return parse(new BufferedReader(r)); }
private void loadNext() { next = null; do{ if (_stringIt.hasNext()){ _line = _stringIt.next(); } else { next = null; return; } ++_lineNo; } while(_line==null || isEntirelyWhitespaceOrEmpty(_line)); //iterate until we get a non-blank line try { next = parseNodesInternal(_line); } catch (Exception e) { _log.warning("Moving on to the next line, as I couldn't parse line " + _lineNo + ": " + _line); e.printStackTrace(); //invalid: skip and try again loadNext(); } if (next == null) return; if(next.length==0)//valid but empty: skip and try again loadNext(); }
public static Node[] parseNodes(final String line) throws ParseException { try { return parseNodesInternal(line); } catch (Exception e) { throw new ParseException(e); } }
private void loadNext() { _next = null; if (_br == null) return; String line = null; try { line = _br.readLine(); if (line != null) do { try { _next = NxParser.parseNodes(line); } catch (ParseException e) { _exceptions.add(e); _next = null; } } while (_next == null && ((line = _br.readLine()) != null)); } catch (IOException e1) { _exceptions.add(e1); } _nextIsFresh = true; }
endIndex = line.indexOf('\"', endIndex + 1); } while (line.charAt(endIndex - 1) == '\\' && (((endIndex - 1 - onlyCharUntil(line, '\\', endIndex - 1)) % 2) == 0));
public Iterator<Node[]> parse(Iterable<String> iterable) { return parse(iterable.iterator()); }
public Iterator<Node[]> parse(InputStream is, Charset cs) { return parse(new BufferedReader(new InputStreamReader(is, cs))); }
public Node[] next(){ if(next==null) throw new NoSuchElementException(); Node[] now = next; loadNext(); return now; }
public Iterator<Node[]> parse(InputStream is) { return parse(new BufferedReader(new InputStreamReader(is))); }