1   package org.slf4j;
2   
3   import java.io.PrintStream;
4   import java.util.ArrayList;
5   import java.util.List;
6   
7   public class StringPrintStream extends PrintStream {
8   
9     public static final String LINE_SEP = System.getProperty("line.separator");
10    PrintStream other;
11    List stringList = new ArrayList();
12    
13    public StringPrintStream(PrintStream ps) {
14      super(ps);
15      other = ps;
16    }
17  
18    public void print(String s) {
19      other.print(s);
20      stringList.add(s);
21    }
22  
23    public void println(String s) {
24      other.println(s);
25      stringList.add(s);
26      
27    }
28    
29    public void println(Object o) {
30      other.println(o);
31      stringList.add(o);
32    }
33  }
34