KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > finalist > jag > JagTextBlockWriter


1 /* Copyright (C) 2003 Finalist IT Group
2  *
3  * This file is part of JAG - the Java J2EE Application Generator
4  *
5  * JAG is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * JAG is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  * You should have received a copy of the GNU General Public License
14  * along with JAG; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */

17
18 package com.finalist.jag;
19
20
21 import com.finalist.jag.template.*;
22
23
24 /**
25  * Class JagTextBlockWriter
26  *
27  *
28  * @author Wendel D. de Witte
29  * @version %I%, %G%
30  */

31 public class JagTextBlockWriter extends JagWriter {
32
33    /** Field buffer */
34    private TemplateTextBlock buffer = null;
35
36
37    /**
38     * Constructor JagTextBlockWriter
39     *
40     *
41     */

42    public JagTextBlockWriter() {
43       buffer = new TemplateTextBlock("");
44    }
45
46
47    /**
48     * Constructor JagTextBlockWriter
49     *
50     *
51     * @param buffer
52     *
53     */

54    public JagTextBlockWriter(TemplateTextBlock buffer) {
55       this.buffer = buffer;
56    }
57
58
59    /**
60     * Clear the contents of the buffer.
61     */

62    public void clear() {
63       buffer.set();
64    }
65
66
67    /**
68     * Write a line separator.
69     */

70    public void newLine() {
71       buffer.append(java.io.File.separator);
72    }
73
74
75    /**
76     * Print a boolean value.
77     *
78     * @param b
79     */

80    public void print(boolean b) {
81       buffer.append(new StringBuffer JavaDoc().append(b));
82    }
83
84
85    /**
86     * Print a character.
87     *
88     * @param c
89     */

90    public void print(char c) {
91       buffer.append(new StringBuffer JavaDoc().append(c));
92    }
93
94
95    /**
96     * Print an array of characters.
97     *
98     * @param s
99     */

100    public void print(char[] s) {
101       buffer.append(new StringBuffer JavaDoc().append(s));
102    }
103
104
105    /**
106     * Print a double-precision floating-point number.
107     *
108     * @param d
109     */

110    public void print(double d) {
111       buffer.append(new StringBuffer JavaDoc().append(d));
112    }
113
114
115    /**
116     * Print a floating-point number.
117     *
118     * @param f
119     */

120    public void print(float f) {
121       buffer.append(new StringBuffer JavaDoc().append(f));
122    }
123
124
125    /**
126     * Print an integer.
127     *
128     * @param i
129     */

130    public void print(int i) {
131       buffer.append(new StringBuffer JavaDoc().append(i));
132    }
133
134
135    /**
136     * Print a long integer.
137     *
138     * @param l
139     */

140    public void print(long l) {
141       buffer.append(new StringBuffer JavaDoc().append(l));
142    }
143
144
145    /**
146     * Print an object.
147     *
148     * @param obj
149     */

150    public void print(Object JavaDoc obj) {
151       buffer.append(new StringBuffer JavaDoc().append(obj));
152    }
153
154
155    /**
156     * Print a string.
157     *
158     * @param s
159     */

160    public void print(String JavaDoc s) {
161       buffer.append(s);
162    }
163
164
165    /**
166     * Terminate the current line by writing the line separator string.
167     */

168    public void println() {
169       newLine();
170    }
171
172
173    /**
174     * Print a boolean value and then terminate the line.
175     *
176     * @param x
177     */

178    public void println(boolean x) {
179       print(x);
180       newLine();
181    }
182
183
184    /**
185     * Print a character and then terminate the line.
186     *
187     * @param x
188     */

189    public void println(char x) {
190       print(x);
191       newLine();
192    }
193
194
195    /**
196     * Print an array of characters and then terminate the line.
197     *
198     * @param x
199     */

200    public void println(char[] x) {
201       print(x);
202       newLine();
203    }
204
205
206    /**
207     * Print a double-precision floating-point number and then terminate the line.
208     *
209     * @param x
210     */

211    public void println(double x) {
212       print(x);
213       newLine();
214    }
215
216
217    /**
218     * Print a floating-point number and then terminate the line.
219     *
220     * @param x
221     */

222    public void println(float x) {
223       print(x);
224       newLine();
225    }
226
227
228    /**
229     * Print an integer and then terminate the line.
230     *
231     * @param x
232     */

233    public void println(int x) {
234       print(x);
235       newLine();
236    }
237
238
239    /**
240     * Print a long integer and then terminate the line.
241     *
242     * @param x
243     */

244    public void println(long x) {
245       print(x);
246       newLine();
247    }
248
249
250    /**
251     * Print an Object and then terminate the line.
252     *
253     * @param x
254     */

255    public void println(Object JavaDoc x) {
256       print(x);
257       newLine();
258    }
259
260
261    /**
262     * Print a String and then terminate the line.
263     *
264     * @param x
265     */

266    public void println(String JavaDoc x) {
267       print(x);
268       newLine();
269    }
270
271
272    /**
273     * Method createNewFile
274     *
275     *
276     * @param path
277     *
278     */

279    public void createNewFile(java.lang.String JavaDoc path) {
280       buffer.setFile(path);
281    }
282
283
284    /**
285     * Method createNewFile
286     *
287     *
288     * @param path
289     *
290     */

291    public void createNewFile(java.lang.StringBuffer JavaDoc path) {
292       createNewFile(new String JavaDoc(path));
293    }
294 }
295
296 ;
Popular Tags