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: * Transforms to lowercase
19: *
20: * @author Pierre van Rooden
21: * @since MMBase-1.7
22: * @version $Id: LowerCaser.java,v 1.2 2004/04/15 14:10:07 michiel Exp $
23: */
24:
25: public class LowerCaser extends ReaderTransformer implements
26: CharTransformer {
27: private static Logger log = Logging
28: .getLoggerInstance(LowerCaser.class);
29:
30: public Writer transform(Reader r, Writer w) {
31: try {
32: log.debug("Starting lowercasing");
33: while (true) {
34: int c = r.read();
35: if (c == -1)
36: break;
37: w.write(Character.toLowerCase((char) c));
38: }
39: log.debug("Finished lowercasing");
40: } catch (java.io.IOException e) {
41: log.error(e.toString());
42: }
43: return w;
44: }
45:
46: public String toString() {
47: return "LOWERCASER";
48: }
49: }
|