diff options
| author | Joshua Rahm <joshua.rahm@colorado.edu> | 2015-01-30 17:11:48 -0700 |
|---|---|---|
| committer | Joshua Rahm <joshua.rahm@colorado.edu> | 2015-01-30 17:11:48 -0700 |
| commit | 1c5e38fe69ac8a6decbdd8abe93112f4e3369315 (patch) | |
| tree | 926cef8cb76d46862ed2c4ec7028720611e47476 /src/StandardIO/FileOutputArray.java | |
| download | Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.gz Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.bz2 Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.zip | |
added source
Diffstat (limited to 'src/StandardIO/FileOutputArray.java')
| -rw-r--r-- | src/StandardIO/FileOutputArray.java | 49 |
1 files changed, 49 insertions, 0 deletions
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<String> 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<String> 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 |