diff options
author | Iru Cai <mytbk920423@gmail.com> | 2014-12-13 10:12:42 +0800 |
---|---|---|
committer | Iru Cai <mytbk920423@gmail.com> | 2014-12-13 10:12:42 +0800 |
commit | ec2b376fd33c48a84374ff392ea0165fa8a6a650 (patch) | |
tree | d5b0f87cad4d7c660972792bb72ba8a067ac52b7 /src/aux | |
parent | bac983173e07000980b8eb9f82b0b86ca8f7c894 (diff) | |
download | minijava-master.tar.xz |
Diffstat (limited to 'src/aux')
-rw-r--r-- | src/aux/CCPrinter.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/aux/CCPrinter.java b/src/aux/CCPrinter.java new file mode 100644 index 0000000..658f1a1 --- /dev/null +++ b/src/aux/CCPrinter.java @@ -0,0 +1,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()); + } +} |