KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > dbforms > util > JspWriterBuffer


1 /*
2  * $Header: /cvsroot/jdbforms/dbforms/src/org/dbforms/util/JspWriterBuffer.java,v 1.4 2004/08/18 12:26:09 hkollmann Exp $
3  * $Revision: 1.4 $
4  * $Date: 2004/08/18 12:26:09 $
5  *
6  * DbForms - a Rapid Application Development Framework
7  * Copyright (C) 2001 Joachim Peer <joepeer@excite.com>
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * This library is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with this library; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22  */

23
24 package org.dbforms.util;
25
26 import java.io.IOException JavaDoc;
27
28 /**
29  * Implementation of a JspWriter which do not write anything
30  */

31 import javax.servlet.ServletResponse JavaDoc;
32 import javax.servlet.jsp.JspWriter JavaDoc;
33
34
35
36 /**
37  * DOCUMENT ME!
38  *
39  * @author $author$
40  * @version $Revision: 1.4 $
41  */

42 public class JspWriterBuffer extends JspWriter JavaDoc {
43    private StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
44
45    /**
46     * Creates a new JspWriterDummy object.
47     *
48     * @param bufferSize DOCUMENT ME!
49     * @param autoFlush DOCUMENT ME!
50     * @param response DOCUMENT ME!
51     */

52    protected JspWriterBuffer(int bufferSize,
53                              boolean autoFlush,
54                              ServletResponse JavaDoc response) {
55       super(bufferSize, autoFlush);
56    }
57
58    /**
59     * DOCUMENT ME!
60     *
61     * @return DOCUMENT ME!
62     */

63    public StringBuffer JavaDoc getBuffer() {
64       return buf;
65    }
66
67
68    /**
69     * DOCUMENT ME!
70     *
71     * @return DOCUMENT ME!
72     */

73    public int getRemaining() {
74       return 0;
75    }
76
77
78    /**
79     * DOCUMENT ME!
80     *
81     * @return DOCUMENT ME!
82     */

83    public String JavaDoc getResult() {
84       return buf.toString();
85    }
86
87
88    /**
89     * DOCUMENT ME!
90     *
91     * @throws IOException DOCUMENT ME!
92     */

93    public void clear() throws IOException JavaDoc {
94       clearBuffer();
95    }
96
97
98    /**
99     * DOCUMENT ME!
100     *
101     * @throws IOException DOCUMENT ME!
102     */

103    public void clearBuffer() throws IOException JavaDoc {
104       buf = new StringBuffer JavaDoc();
105    }
106
107
108    /**
109     * DOCUMENT ME!
110     *
111     * @throws IOException DOCUMENT ME!
112     */

113    public void close() throws IOException JavaDoc {
114    }
115
116
117    /**
118     * DOCUMENT ME!
119     *
120     * @throws IOException DOCUMENT ME!
121     */

122    public void flush() throws IOException JavaDoc {
123    }
124
125
126    /**
127     * DOCUMENT ME!
128     *
129     * @throws IOException DOCUMENT ME!
130     */

131    public void newLine() throws IOException JavaDoc {
132    }
133
134
135    /**
136     * DOCUMENT ME!
137     *
138     * @param b DOCUMENT ME!
139     *
140     * @throws IOException DOCUMENT ME!
141     */

142    public void print(boolean b) throws IOException JavaDoc {
143       buf.append(b);
144    }
145
146
147    /**
148     * DOCUMENT ME!
149     *
150     * @param c DOCUMENT ME!
151     *
152     * @throws IOException DOCUMENT ME!
153     */

154    public void print(char c) throws IOException JavaDoc {
155       buf.append(c);
156    }
157
158
159    /**
160     * DOCUMENT ME!
161     *
162     * @param s DOCUMENT ME!
163     *
164     * @throws IOException DOCUMENT ME!
165     */

166    public void print(char[] s) throws IOException JavaDoc {
167       buf.append(s);
168    }
169
170
171    /**
172     * DOCUMENT ME!
173     *
174     * @param i DOCUMENT ME!
175     *
176     * @throws IOException DOCUMENT ME!
177     */

178    public void print(int i) throws IOException JavaDoc {
179       buf.append(i);
180    }
181
182
183    /**
184     * DOCUMENT ME!
185     *
186     * @param l DOCUMENT ME!
187     *
188     * @throws IOException DOCUMENT ME!
189     */

190    public void print(long l) throws IOException JavaDoc {
191       buf.append(l);
192    }
193
194
195    /**
196     * DOCUMENT ME!
197     *
198     * @param f DOCUMENT ME!
199     *
200     * @throws IOException DOCUMENT ME!
201     */

202    public void print(float f) throws IOException JavaDoc {
203       buf.append(f);
204    }
205
206
207    /**
208     * DOCUMENT ME!
209     *
210     * @param d DOCUMENT ME!
211     *
212     * @throws IOException DOCUMENT ME!
213     */

214    public void print(double d) throws IOException JavaDoc {
215       buf.append(d);
216    }
217
218
219    /**
220     * DOCUMENT ME!
221     *
222     * @param s DOCUMENT ME!
223     *
224     * @throws IOException DOCUMENT ME!
225     */

226    public void print(String JavaDoc s) throws IOException JavaDoc {
227       buf.append(s);
228    }
229
230
231    /**
232     * DOCUMENT ME!
233     *
234     * @param obj DOCUMENT ME!
235     *
236     * @throws IOException DOCUMENT ME!
237     */

238    public void print(Object JavaDoc obj) throws IOException JavaDoc {
239       buf.append(obj);
240    }
241
242
243    /**
244     * DOCUMENT ME!
245     *
246     * @throws IOException DOCUMENT ME!
247     */

248    public void println() throws IOException JavaDoc {
249       buf.append('\n');
250    }
251
252
253    /**
254     * DOCUMENT ME!
255     *
256     * @param x DOCUMENT ME!
257     *
258     * @throws IOException DOCUMENT ME!
259     */

260    public void println(boolean x) throws IOException JavaDoc {
261       print(x);
262       println();
263    }
264
265
266    /**
267     * DOCUMENT ME!
268     *
269     * @param x DOCUMENT ME!
270     *
271     * @throws IOException DOCUMENT ME!
272     */

273    public void println(char x) throws IOException JavaDoc {
274       print(x);
275       println();
276    }
277
278
279    /**
280     * DOCUMENT ME!
281     *
282     * @param x DOCUMENT ME!
283     *
284     * @throws IOException DOCUMENT ME!
285     */

286    public void println(int x) throws IOException JavaDoc {
287       print(x);
288       println();
289    }
290
291
292    /**
293     * DOCUMENT ME!
294     *
295     * @param x DOCUMENT ME!
296     *
297     * @throws IOException DOCUMENT ME!
298     */

299    public void println(long x) throws IOException JavaDoc {
300       print(x);
301       println();
302    }
303
304
305    /**
306     * DOCUMENT ME!
307     *
308     * @param x DOCUMENT ME!
309     *
310     * @throws IOException DOCUMENT ME!
311     */

312    public void println(float x) throws IOException JavaDoc {
313       print(x);
314       println();
315    }
316
317
318    /**
319     * DOCUMENT ME!
320     *
321     * @param x DOCUMENT ME!
322     *
323     * @throws IOException DOCUMENT ME!
324     */

325    public void println(double x) throws IOException JavaDoc {
326       print(x);
327       println();
328    }
329
330
331    /**
332     * DOCUMENT ME!
333     *
334     * @param x DOCUMENT ME!
335     *
336     * @throws IOException DOCUMENT ME!
337     */

338    public void println(char[] x) throws IOException JavaDoc {
339       print(x);
340       println();
341    }
342
343
344    /**
345     * DOCUMENT ME!
346     *
347     * @param x DOCUMENT ME!
348     *
349     * @throws IOException DOCUMENT ME!
350     */

351    public void println(String JavaDoc x) throws IOException JavaDoc {
352       print(x);
353       println();
354    }
355
356
357    /**
358     * DOCUMENT ME!
359     *
360     * @param x DOCUMENT ME!
361     *
362     * @throws IOException DOCUMENT ME!
363     */

364    public void println(Object JavaDoc x) throws IOException JavaDoc {
365       print(x);
366       println();
367    }
368
369
370    /**
371     * DOCUMENT ME!
372     *
373     * @param c DOCUMENT ME!
374     *
375     * @throws IOException DOCUMENT ME!
376     */

377    public void write(int c) throws IOException JavaDoc {
378       buf.append(c);
379    }
380
381
382    /**
383     * DOCUMENT ME!
384     *
385     * @param cbuf DOCUMENT ME!
386     * @param off DOCUMENT ME!
387     * @param len DOCUMENT ME!
388     *
389     * @throws IOException DOCUMENT ME!
390     */

391    public void write(char[] cbuf,
392                      int off,
393                      int len) throws IOException JavaDoc {
394       buf.append(cbuf, off, len);
395    }
396
397
398    /**
399     * DOCUMENT ME!
400     *
401     * @param str DOCUMENT ME!
402     * @param off DOCUMENT ME!
403     * @param len DOCUMENT ME!
404     *
405     * @throws IOException DOCUMENT ME!
406     */

407    public void write(String JavaDoc str,
408                      int off,
409                      int len) throws IOException JavaDoc {
410       write(str.toCharArray(), off, len);
411    }
412 }
413
Popular Tags