/** Sets this parser back to the beginning of the raw data. */ public void reset() { close(); try { in = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { System.err.println("Can't open '" + fileName + "' for input:"); e.printStackTrace(); System.exit(1); } }
/** * Reads a line from the current buffer and returns it. When there are no more lines in the * input file, the stream is closed, and <code>null</code> will be returned by this method * thereafter. Returned strings do not contain line termination characters. * * @return The next line of text from the input file, or <code>null</code> if no more lines * remain. **/ protected String readLine() { if (in == null) return null; String line = null; try { line = in.readLine(); } catch (Exception e) { System.err.println("Can't read from '" + fileName + "':"); e.printStackTrace(); System.exit(1); } if (line == null) { close(); in = null; } return line; }