aboutsummaryrefslogtreecommitdiff
path: root/src/StandardIO/FileOutputArray.java
blob: 923b07520b1d17d397b52aa76edac2d3cd19b52f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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
 */