1: //: io/BasicFileOutput.java 2: import java.io.*; 3: 4: public class BasicFileOutput { 5: static String file = "BasicFileOutput.out"; 6: public static void main(String[] args) 7: throws IOException { 8: BufferedReader in = new BufferedReader( 9: new StringReader( 10: BufferedInputFile.read("BasicFileOutput.java"))); 11: PrintWriter out = new PrintWriter( 12: new BufferedWriter(new FileWriter(file))); 13: int lineCount = 1; 14: String s; 15: while((s = in.readLine()) != null ) 16: out.println(lineCount++ + ": " + s); 17: out.close(); 18: // Show the stored file: 19: System.out.println(BufferedInputFile.read(file)); 20: } 21: } /* (Execute to see output) *///:~