package text; import java.io.*; public class PlainOutput { private PrintWriter printWriter; public PlainOutput( File file ) throws Error { try { OutputStream outputStream = new FileOutputStream( file ); printWriter = new PrintWriter( outputStream ); } catch ( IOException exception ) { throw new Error( "Unable to open file " + file ); } } public void println() { printWriter.println(); printWriter.flush(); } public void println( Object s ) { printWriter.println( s ); printWriter.flush(); } public void print( Object s ) { printWriter.print( s ); printWriter.flush(); } public void print( char c ) { printWriter.print( c ); printWriter.flush(); } public void printStackTrace( Throwable throwable ) { throwable.printStackTrace( printWriter ); printWriter.flush(); } }