1 40 41 42 package org.jahia.services.applications; 43 44 import java.io.PrintWriter ; 45 import java.io.Writer ; 46 47 48 58 public class StringPrintWriter extends PrintWriter { 59 60 61 private static org.apache.log4j.Logger logger = 62 org.apache.log4j.Logger.getLogger (StringPrintWriter.class); 63 64 private StringBuffer strBuffer = new StringBuffer (4096); 65 private static boolean debugPrintWriter = false; 66 67 public StringPrintWriter (java.io.OutputStream out) { 68 super (out); 69 } 70 71 public StringPrintWriter (Writer out) { 72 super (out); 73 } 74 75 public StringPrintWriter (java.io.OutputStream out, boolean autoFlush) { 76 super (out, autoFlush); 77 } 78 79 public StringPrintWriter (Writer writer, boolean autoFlush) { 80 super (writer, autoFlush); 81 } 82 83 public StringPrintWriter (Writer writer, StringBuffer newBuffer) { 84 super (writer); 85 strBuffer = newBuffer; 86 } 87 88 public void print (boolean b) { 89 strBuffer.append (b); 90 } 91 92 public void print (char c) { 93 strBuffer.append (c); 95 } 96 97 public void print (char[] s) { 98 strBuffer.append (s); 100 } 101 102 public void print (double d) { 103 strBuffer.append (d); 104 } 105 106 public void print (float f) { 107 strBuffer.append (f); 108 } 109 110 public void print (int i) { 111 strBuffer.append (i); 112 } 113 114 public void print (long l) { 115 strBuffer.append (l); 116 } 117 118 public void print (Object obj) { 119 strBuffer.append (obj); 120 } 121 122 public void print (String s) { 123 strBuffer.append (s); 125 } 126 127 public void println () { 128 strBuffer.append ("\n"); 130 } 131 132 public void println (boolean b) { 133 strBuffer.append (b); 134 strBuffer.append ("\n"); 135 } 136 137 public void println (char c) { 138 strBuffer.append (c); 140 strBuffer.append ("\n"); 141 } 142 143 public void println (char[] s) { 144 strBuffer.append (s); 146 strBuffer.append ("\n"); 147 } 148 149 public void println (double d) { 150 strBuffer.append (d); 151 strBuffer.append ("\n"); 152 } 153 154 public void println (float f) { 155 strBuffer.append (f); 156 strBuffer.append ("\n"); 157 } 158 159 public void println (int i) { 160 strBuffer.append (i); 161 strBuffer.append ("\n"); 162 } 163 164 public void println (long l) { 165 strBuffer.append (l); 166 strBuffer.append ("\n"); 167 } 168 169 public void println (Object obj) { 170 strBuffer.append (obj); 171 strBuffer.append ("\n"); 172 } 173 174 public void println (String x) { 175 strBuffer.append (x); 177 strBuffer.append ("\n"); 178 } 179 180 public void write (char[] cbuf) { 181 strBuffer.append (cbuf); 183 } 184 185 public void write (char[] cbuf, int off, int len) { 186 strBuffer.append (cbuf, off, len); 188 } 189 190 public void write (int c) { 191 strBuffer.append ((char) c); 194 } 195 196 public void write (String s) { 197 strBuffer.append (s); 199 } 200 201 public void write (String str, int off, int len) { 202 strBuffer.append (str.substring (off, off + len)); } 205 206 public String getBuffer () { 207 return strBuffer.toString (); 208 } 209 210 public void flush () { 211 } 212 213 public void close () { 214 } 215 216 public boolean checkError () { 217 return false; 219 } 220 221 private static void debugLog (String message) { 222 if (debugPrintWriter) { 223 logger.debug (message); 224 } 225 } 226 227 } 228 | Popular Tags |