From 1c5e38fe69ac8a6decbdd8abe93112f4e3369315 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Fri, 30 Jan 2015 17:11:48 -0700 Subject: added source --- src/StandardIO/FileOutputArray.java | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/StandardIO/FileOutputArray.java (limited to 'src/StandardIO/FileOutputArray.java') diff --git a/src/StandardIO/FileOutputArray.java b/src/StandardIO/FileOutputArray.java new file mode 100644 index 0000000..923b075 --- /dev/null +++ b/src/StandardIO/FileOutputArray.java @@ -0,0 +1,49 @@ +/* */ package StandardIO; +/* */ +/* */ import java.io.File; +/* */ import java.io.IOException; +/* */ import java.io.PrintStream; +/* */ import java.io.PrintWriter; +/* */ import java.util.ArrayList; +/* */ import java.util.List; +/* */ +/* */ public class FileOutputArray +/* */ { +/* */ private List output; +/* */ +/* */ public FileOutputArray() +/* */ { +/* 15 */ this.output = new ArrayList(); +/* */ } +/* */ public void flushToFile(String file) { +/* */ try { +/* 19 */ PrintWriter stream = new SaveFileWriter(file); +/* 20 */ for (int i = 0; i < this.output.size(); i++) { +/* 21 */ stream.print((String)this.output.get(i)); +/* */ } +/* 23 */ stream.flush(); +/* 24 */ stream.close(); +/* */ } +/* */ catch (IOException e) { +/* 27 */ e.printStackTrace(); +/* 28 */ System.err.println("File could not be written."); +/* */ } +/* */ } +/* */ +/* 32 */ public void flushToFile(File f) { flushToFile(f.toString()); } +/* */ +/* */ public void reset() { +/* 35 */ this.output = new ArrayList(); +/* */ } +/* */ public void setOutput(List arr) { +/* 38 */ this.output = arr; +/* */ } +/* */ public void append(String what) { +/* 41 */ this.output.add(what); +/* */ } +/* */ } + +/* Location: Modulus.jar + * Qualified Name: StandardIO.FileOutputArray + * JD-Core Version: 0.6.2 + */ \ No newline at end of file -- cgit