01: /*
02: * Created on Jun 17, 2005
03: */
04: package uk.org.ponder.streamutil.write;
05:
06: import java.io.PrintStream;
07:
08: /**
09: * @author Antranig Basman (antranig@caret.cam.ac.uk)
10: *
11: */
12: public class PrintStreamPOS implements PrintOutputStream {
13: private PrintStream printstream;
14:
15: public PrintStreamPOS(PrintStream printstream) {
16: this .printstream = printstream;
17: }
18:
19: public void println(String toprint) {
20: printstream.println(toprint);
21: }
22:
23: public void flush() {
24: printstream.flush();
25: }
26:
27: public void close() {
28: if (printstream != System.out && printstream != System.err) {
29: printstream.close();
30: }
31: }
32:
33: public PrintOutputStream print(String string) {
34: printstream.print(string);
35: return this ;
36: }
37:
38: public void println() {
39: printstream.println();
40: }
41:
42: public void println(Object obj) {
43: printstream.println(obj);
44: }
45:
46: public void write(char[] storage, int offset, int size) {
47: String toprint = new String(storage, offset, size);
48: print(toprint);
49: }
50: }
|