Code example for LineNumberReader

Methods: getLineNumber

0
		if (!_curFile.exists()) {
			throwError("File does not exist", null); 
		} 
		_fileLength = _curFile.length();
		try { 
			_reader = new LineNumberReader(new FileReader(_curFile));
		} catch (Exception e) {
			throwError("Unable to open file", e);
		} 
	} 
 
	/** 
	 * throw exception with filename and current line number added to the error 
	 * message. 
	 */ 
	private void throwError(String errMsg, Throwable cause) {
		String lineInfo = " [" + _curFile.toString() + ":";
		if (_reader == null)
			lineInfo += "<unknown>]";
		else 
			lineInfo += _reader.getLineNumber() + "]";
		throw new ParserError(errMsg + lineInfo, cause);
	} 
 
	/** 
	 * Reads next line from the reader. Keeps track of the estimated bytes read