1 2 25 26 package org.aspectj.ajde.internal; 27 28 import java.io.*; 29 30 36 public class StreamPrintWriter extends PrintWriter { 37 private String contents = ""; 38 39 public StreamPrintWriter(Writer out) { 40 super(out); 41 } 42 43 public String getContents() { 44 return contents; 45 } 46 47 public void flushBuffer() { 48 contents = ""; 49 super.flush(); 50 } 51 52 public void print(char x) { 53 contents += x + "\n"; 54 } 55 56 public void print(char[] x) { 57 contents += new String ( x ); 58 } 59 60 public void print(int x) { 61 contents += x; 62 } 63 64 public void print(String x) { 65 contents += x; 66 } 67 68 public void println(char x) { 69 contents += x + "\n"; 70 } 71 72 public void println(char[] x) { 73 contents += new String ( x ) + "\n"; 74 } 75 76 public void println(int x) { 77 contents += x + "\n"; 78 } 79 80 public void println(String x) { 81 contents += x + "\n"; 82 } 83 84 public void write( byte[] x ) { 85 contents += new String ( x ); 86 } 87 88 public void write( byte[] x, int i1, int i2 ) { 89 StringWriter writer = new StringWriter(); 90 String s = new String ( x ); 91 writer.write( s.toCharArray(), i1, i2 ); 92 contents += writer.getBuffer().toString(); 93 } 94 95 public void write( int c ) { 96 contents += c; 97 } 98 99 public void write( String s ) { 100 contents += s; 101 } 102 103 public void write( String s, int i1, int i2 ) { 104 contents += s; 105 } 106 } 107 | Popular Tags |