Get the LineNumberReader for this file, creating it if necessary. This method ensures that we're not already writing to this file before allowing read access. If no reader exists, it creates one using either the specified file or System.in if no file was specified. @return the LineNumberReader
()
| 313 | * @throws FileNotFoundException if the specified file cannot be found or opened |
| 314 | */ |
| 315 | private LineNumberReader getReader() throws FileNotFoundException { |
| 316 | if (writer != null) { |
| 317 | throw Context.reportRuntimeError("already writing file \"" + name + "\""); |
| 318 | } |
| 319 | if (reader == null) |
| 320 | reader = |
| 321 | new LineNumberReader( |
| 322 | file == null ? new InputStreamReader(System.in) : new FileReader(file)); |
| 323 | return reader; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Perform the common functionality for write and writeLine methods. |
no test coverage detected