blob: 658f1a176fa3dd05e661870b8e878ec930120a96 (
plain)
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
|
package aux;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.util.Vector;
public class CCPrinter {
Vector<String> msgs;
public CCPrinter() {
msgs = new Vector<String>();
}
public void print(String s) {
msgs.addElement(s);
}
public void println(String s) {
msgs.addElement(s+"\n");
}
public void printAll() {
for (int i=0; i<msgs.size(); i++) {
System.out.print(msgs.elementAt(i));
}
}
public InputStream toInputStream() {
String tmp = "";
for (int i=0; i<msgs.size(); i++) {
tmp += msgs.elementAt(i);
}
return new ByteArrayInputStream(tmp.getBytes());
}
}
|