1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.springframework.extensions.surf.util;
20
21 import java.io.IOException;
22 import java.io.PrintWriter;
23 import java.io.Writer;
24
25 import javax.servlet.jsp.JspWriter;
26
27
28
29
30 public class FakeJspWriter extends JspWriter
31 {
32
33 private Writer rootWriter = null;
34
35
36 private PrintWriter printWriter = null;
37
38
39
40
41 public FakeJspWriter() {
42 super(0, false);
43
44 rootWriter = new StringBuilderWriter(512);
45 printWriter = new PrintWriter(rootWriter);
46 }
47
48
49
50
51
52
53
54 public FakeJspWriter(Writer myWriter) {
55 super(0, false);
56
57 this.rootWriter = myWriter;
58 printWriter = new PrintWriter(myWriter);
59 }
60
61
62
63
64
65
66
67
68
69 public FakeJspWriter(int arg0, boolean arg1) {
70 super(arg0, arg1);
71
72 rootWriter = new StringBuilderWriter(512);
73 printWriter = new PrintWriter(rootWriter);
74 }
75
76
77
78
79
80
81 public PrintWriter getPrintWriter() {
82 return printWriter;
83 }
84
85
86
87
88
89
90 public Writer getRootWriter() {
91 return rootWriter;
92 }
93
94
95
96
97 @Override
98 public void newLine() throws IOException {
99 printWriter.println();
100 }
101
102
103
104
105 @Override
106 public void print(boolean arg0) throws IOException {
107 printWriter.print(arg0);
108 }
109
110
111
112
113 @Override
114 public void print(char arg0) throws IOException {
115 printWriter.print(arg0);
116 }
117
118
119
120
121 @Override
122 public void print(int arg0) throws IOException {
123 printWriter.print(arg0);
124 }
125
126
127
128
129 @Override
130 public void print(long arg0) throws IOException {
131 printWriter.print(arg0);
132 }
133
134
135
136
137 @Override
138 public void print(float arg0) throws IOException {
139 printWriter.print(arg0);
140 }
141
142
143
144
145 @Override
146 public void print(double arg0) throws IOException {
147 printWriter.print(arg0);
148 }
149
150
151
152
153 @Override
154 public void print(char[] arg0) throws IOException {
155 printWriter.print(arg0);
156 }
157
158
159
160
161 @Override
162 public void print(String arg0) throws IOException {
163 printWriter.print(arg0);
164 }
165
166
167
168
169 @Override
170 public void print(Object arg0) throws IOException {
171 printWriter.print(arg0);
172 }
173
174
175
176
177 @Override
178 public void println() throws IOException {
179 printWriter.println();
180 }
181
182
183
184
185 @Override
186 public void println(boolean arg0) throws IOException {
187 printWriter.println(arg0);
188 }
189
190
191
192
193 @Override
194 public void println(char arg0) throws IOException {
195 printWriter.println(arg0);
196 }
197
198
199
200
201 @Override
202 public void println(int arg0) throws IOException {
203 printWriter.println(arg0);
204 }
205
206
207
208
209 @Override
210 public void println(long arg0) throws IOException {
211 printWriter.println(arg0);
212 }
213
214
215
216
217 @Override
218 public void println(float arg0) throws IOException {
219 printWriter.println(arg0);
220 }
221
222
223
224
225 @Override
226 public void println(double arg0) throws IOException {
227 printWriter.println(arg0);
228 }
229
230
231
232
233 @Override
234 public void println(char[] arg0) throws IOException {
235 printWriter.println(arg0);
236 }
237
238
239
240
241 @Override
242 public void println(String arg0) throws IOException {
243 printWriter.println(arg0);
244 }
245
246
247
248
249 @Override
250 public void println(Object arg0) throws IOException {
251 printWriter.println(arg0);
252 }
253
254
255
256
257 @Override
258 public void clear() throws IOException {
259 }
260
261
262
263
264 @Override
265 public void clearBuffer() throws IOException {
266 }
267
268
269
270
271 @Override
272 public void flush() throws IOException {
273 printWriter.flush();
274 }
275
276
277
278
279 @Override
280 public void close() throws IOException {
281 printWriter.close();
282 }
283
284
285
286
287 @Override
288 public int getRemaining() {
289 return 0;
290 }
291
292
293
294
295 @Override
296 public void write(char[] cbuf, int off, int len) throws IOException {
297 printWriter.write(cbuf, off, len);
298 }
299
300 }