Streams Lab. Solution for writing ASCII file

/** * for an application ONLY ! * write String of text into a file * @param iFilename * @param iString to write into a file * @return true if success, false if failure * @@author Jeff Zhuk **/ public static boolean writeFile( String iFilename, String iString) { try { PrintWriter out = new PrintWriter( new BufferedWriter(new FileWriter(iFilename))); out.print(iString); out.flush(); out.close(); return true; // success ! } catch (IOException e) { System.err.println("writeFile failure: " + e); return false; // failure } } } // end of StreamsLab class

Back to I/O Classes Overview