/** report progress */ public void setReportProgress(boolean reportProgress) { if (reportProgress) { if (progress == null) { if (!fileName.startsWith(PREFIX_TO_INDICATE_TO_PARSE_FILENAME_STRING)) progress = new ProgressPercentage("Processing file: " + fileName, getMaximumProgress()); else progress = new ProgressPercentage("Processing string", getMaximumProgress()); } } else { if (progress != null) { progress.close(); progress = null; } } }
/** * gets the next line in the file * * @return next line */ public String next() { if (pushedBackLine != null) { String value = pushedBackLine; pushedBackLine = null; return value; } if (done) return null; if (nextLine == null) hasNext(); if (nextLine != null) { String result = nextLine; nextLine = null; lineNumber++; if (progress != null) { progress.setProgress(position); } return result; } return null; }
/** close associated file or database */ public void close() throws IOException { reader.close(); if (progress != null) progress.close(); }