01: /*
02:
03: This software is OSI Certified Open Source Software.
04: OSI Certified is a certification mark of the Open Source Initiative.
05:
06: The license (Mozilla version 1.0) can be read at the MMBase site.
07: See http://www.MMBase.org/license
08:
09: */
10: package org.mmbase.util.transformers;
11:
12: import java.io.Reader;
13: import java.io.Writer;
14:
15: import org.mmbase.util.logging.*;
16:
17: /**
18: * A 'hello world' for CharTransformers.
19: *
20: * @author Michiel Meeuwissen
21: * @since MMBase-1.7
22: * @version $Id: UpperCaser.java,v 1.4 2003/05/12 11:15:35 michiel Exp $
23: */
24:
25: public class UpperCaser extends ReaderTransformer implements
26: CharTransformer {
27: private static Logger log = Logging
28: .getLoggerInstance(UpperCaser.class);
29:
30: public Writer transform(Reader r, Writer w) {
31: try {
32: log.debug("Starting uppercasing");
33: while (true) {
34: int c = r.read();
35: if (c == -1)
36: break;
37: w.write(Character.toUpperCase((char) c));
38: }
39: log.debug("Finished uppercasing");
40: } catch (java.io.IOException e) {
41: log.error(e.toString());
42: }
43: return w;
44: }
45:
46: public String toString() {
47: return "uppercaser";
48: }
49: }
|