001: /* Copyright (C) 2003 Finalist IT Group
002: *
003: * This file is part of JAG - the Java J2EE Application Generator
004: *
005: * JAG is free software; you can redistribute it and/or modify
006: * it under the terms of the GNU General Public License as published by
007: * the Free Software Foundation; either version 2 of the License, or
008: * (at your option) any later version.
009: * JAG is distributed in the hope that it will be useful,
010: * but WITHOUT ANY WARRANTY; without even the implied warranty of
011: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: * GNU General Public License for more details.
013: * You should have received a copy of the GNU General Public License
014: * along with JAG; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
016: */
017:
018: package com.finalist.jag;
019:
020: import com.finalist.jag.template.*;
021:
022: /**
023: * Class JagTextBlockWriter
024: *
025: *
026: * @author Wendel D. de Witte
027: * @version %I%, %G%
028: */
029: public class JagTextBlockWriter extends JagWriter {
030:
031: /** Field buffer */
032: private TemplateTextBlock buffer = null;
033:
034: /**
035: * Constructor JagTextBlockWriter
036: *
037: *
038: */
039: public JagTextBlockWriter() {
040: buffer = new TemplateTextBlock("");
041: }
042:
043: /**
044: * Constructor JagTextBlockWriter
045: *
046: *
047: * @param buffer
048: *
049: */
050: public JagTextBlockWriter(TemplateTextBlock buffer) {
051: this .buffer = buffer;
052: }
053:
054: /**
055: * Clear the contents of the buffer.
056: */
057: public void clear() {
058: buffer.set();
059: }
060:
061: /**
062: * Write a line separator.
063: */
064: public void newLine() {
065: buffer.append(java.io.File.separator);
066: }
067:
068: /**
069: * Print a boolean value.
070: *
071: * @param b
072: */
073: public void print(boolean b) {
074: buffer.append(new StringBuffer().append(b));
075: }
076:
077: /**
078: * Print a character.
079: *
080: * @param c
081: */
082: public void print(char c) {
083: buffer.append(new StringBuffer().append(c));
084: }
085:
086: /**
087: * Print an array of characters.
088: *
089: * @param s
090: */
091: public void print(char[] s) {
092: buffer.append(new StringBuffer().append(s));
093: }
094:
095: /**
096: * Print a double-precision floating-point number.
097: *
098: * @param d
099: */
100: public void print(double d) {
101: buffer.append(new StringBuffer().append(d));
102: }
103:
104: /**
105: * Print a floating-point number.
106: *
107: * @param f
108: */
109: public void print(float f) {
110: buffer.append(new StringBuffer().append(f));
111: }
112:
113: /**
114: * Print an integer.
115: *
116: * @param i
117: */
118: public void print(int i) {
119: buffer.append(new StringBuffer().append(i));
120: }
121:
122: /**
123: * Print a long integer.
124: *
125: * @param l
126: */
127: public void print(long l) {
128: buffer.append(new StringBuffer().append(l));
129: }
130:
131: /**
132: * Print an object.
133: *
134: * @param obj
135: */
136: public void print(Object obj) {
137: buffer.append(new StringBuffer().append(obj));
138: }
139:
140: /**
141: * Print a string.
142: *
143: * @param s
144: */
145: public void print(String s) {
146: buffer.append(s);
147: }
148:
149: /**
150: * Terminate the current line by writing the line separator string.
151: */
152: public void println() {
153: newLine();
154: }
155:
156: /**
157: * Print a boolean value and then terminate the line.
158: *
159: * @param x
160: */
161: public void println(boolean x) {
162: print(x);
163: newLine();
164: }
165:
166: /**
167: * Print a character and then terminate the line.
168: *
169: * @param x
170: */
171: public void println(char x) {
172: print(x);
173: newLine();
174: }
175:
176: /**
177: * Print an array of characters and then terminate the line.
178: *
179: * @param x
180: */
181: public void println(char[] x) {
182: print(x);
183: newLine();
184: }
185:
186: /**
187: * Print a double-precision floating-point number and then terminate the line.
188: *
189: * @param x
190: */
191: public void println(double x) {
192: print(x);
193: newLine();
194: }
195:
196: /**
197: * Print a floating-point number and then terminate the line.
198: *
199: * @param x
200: */
201: public void println(float x) {
202: print(x);
203: newLine();
204: }
205:
206: /**
207: * Print an integer and then terminate the line.
208: *
209: * @param x
210: */
211: public void println(int x) {
212: print(x);
213: newLine();
214: }
215:
216: /**
217: * Print a long integer and then terminate the line.
218: *
219: * @param x
220: */
221: public void println(long x) {
222: print(x);
223: newLine();
224: }
225:
226: /**
227: * Print an Object and then terminate the line.
228: *
229: * @param x
230: */
231: public void println(Object x) {
232: print(x);
233: newLine();
234: }
235:
236: /**
237: * Print a String and then terminate the line.
238: *
239: * @param x
240: */
241: public void println(String x) {
242: print(x);
243: newLine();
244: }
245:
246: /**
247: * Method createNewFile
248: *
249: *
250: * @param path
251: *
252: */
253: public void createNewFile(java.lang.String path) {
254: buffer.setFile(path);
255: }
256:
257: /**
258: * Method createNewFile
259: *
260: *
261: * @param path
262: *
263: */
264: public void createNewFile(java.lang.StringBuffer path) {
265: createNewFile(new String(path));
266: }
267: };
|