import java.io.*; public class FilePrint { private FileWriter fileOut; private BufferedWriter bufOut; private PrintWriter out; private String fileName; public FilePrint(String fname) { fileName = new String(fname); try { fileOut = new FileWriter(fname); bufOut = new BufferedWriter(fileOut); out = new PrintWriter(bufOut); } catch (IOException e) { System.out.println("Unable to create the file: "+fname); System.exit(1); } } public FilePrint(String fname, boolean append) { fileName = new String(fname); try { fileOut = new FileWriter(fname, append); bufOut = new BufferedWriter(fileOut); out = new PrintWriter(bufOut); } catch (IOException e) { System.out.println("Unable to create the file: "+fname); System.exit(1); } } public String getName() { return fileName; } public String toString() { String x = "FilePrint (filename=\""+fileName+"\")"; return x; } public void print(int i) { out.print(i); } public void print(double d) { out.print(d); } public void print(String s) { out.print(s); } public void print(Object o) { out.print(o); } public void print(boolean b) { out.print(b); } public void print(char c) { out.print(c); } public void println(int i) { out.println(i); } public void println(double d) { out.println(d); } public void println(String s) { out.println(s); } public void println(Object o) { out.println(o); } public void println(boolean b) { out.println(b); } public void println(char c) { out.println(c); } public void println() { out.println(); } public void close() { out.close(); } }