// File: Console.java R.L. // Allow reading from console with "read", and // writing to the console with "echo". import java.io.*; public class Console { private BufferedReader buf; private FileReader fr; private InputStreamReader isr; public Console() { isr = new InputStreamReader(System.in); buf = new BufferedReader(isr); } public String read() { String in = ""; try { in = buf.readLine(); } catch (IOException e) { in = ""; } return in; } public void echo(String s) { if (s == null) s = "Error: s is null"; System.out.println(s); } }