SourceCode(String fileName, BufferedReader reader) throws IOException { this.fileName = fileName; try { String line = reader.readLine(); while (line != null) { sourceLines.add(line); line = reader.readLine(); } } finally { reader.close(); } }
private void dumpStream(InputStream stream) throws IOException { BufferedReader in = new BufferedReader(new InputStreamReader(stream)); int i; try { while ((i = in.read()) != -1) { MessageOutput.printDirect((char) i); // Special case: use // printDirect() } } catch (IOException ex) { String s = ex.getMessage(); if (!s.startsWith("Bad file number")) { throw ex; } // else we got a Bad file number IOException which just means // that the debuggee has gone away. We'll just treat it the // same as if we got an EOF. } }