// // MyWordMinder001.java // // This program uses a utlitie (in this case / yea olde "Fibonacci Numbers" program) to // run the data to a file, when then the user // can open and look at/edit. Editing comes // later in this DEV stream. // // This program borrows some of the menu stuff // from MyMenu008.java // // Note that it was created by using MyMenu008 as // the base, and then injecting the MyFileCopier // stuff in it. // // NOTE: The File Copier stuff isn't really // hooked in yet. // // Program DEV branches: // --(PREV)-- MyMenu008.java ???.java --(NEXT)-- // MyFileCopier.java // MyFibonacciList.java // import java.lang.*; import java.io.*; import java.util.StringTokenizer; class MyFileCopier001 { public PrintWriter outFile; public String outFileName; //------------------------------------------------------- public void open_and_copy_file (String inFileName) //------------------------------------------------------- // Copy strings from inFile to outFile (use fname.OUT as output) { BufferedReader inFile; String nextLine; try //----------------------------------- try { inFile = new BufferedReader (new FileReader (inFileName)); outFileName = new String(); outFileName = inFileName + ".out"; PrintWriter outFile = new PrintWriter (new FileWriter (outFileName)); nextLine = inFile.readLine(); while (nextLine != null) { outFile.println (nextLine); nextLine = inFile.readLine(); } System.out.println ("--- file processed: " + outFileName); outFile.close(); System.exit(0); } // end try catch (Exception e) { System.out.println ("*** [Line-042] writeHtmlPage: " + e.getMessage() ); } // end try/catch ---------------------------- end try } // end: open_and_copy_file() // public static void main (String[] args) { if (args.length < 1) { System.out.println ("\n*** Err: You must supply a file name"); System.out.println ("\n eg: java MyFileCopier001 poem01.txt"); System.out.println (" "); System.exit(1); // ie, unix std: 0 = ok, any other means err. } //-- let's go! MyFileCopier001 fileWriter = new MyFileCopier001(); fileWriter.open_and_copy_file (args[0]); // from command-line } // end main() } // end: class MyFileCopier001
Site hosted by Angelfire.com: Build your free website today!