1 26 27 package org.objectweb.jonas.examples.util; 28 29 import java.io.PrintStream ; 30 31 35 public class JPrintStream extends PrintStream { 36 37 38 41 protected PrintStream printStream = null; 42 43 44 47 protected StringBuffer buffer = null; 48 49 53 public JPrintStream(PrintStream printStream) { 54 super(printStream); 55 this.buffer = new StringBuffer (); 56 this.printStream = printStream; 57 System.setOut(this); 58 } 59 60 64 public StringBuffer getStringBuffer() { 65 return buffer; 66 } 67 68 69 73 public void println(String x) { 74 buffer.append(x); 75 } 78 79 83 public void println(Object x) { 84 buffer.append(x.toString()); 85 } 86 87 90 public void reset() { 91 buffer = new StringBuffer (); 92 } 93 94 97 public void remove() { 98 System.setOut(printStream); 99 } 100 } 101 | Popular Tags |