1 16 17 package org.apache.commons.latka; 18 19 import java.io.PrintWriter ; 20 import java.io.Writer ; 21 22 36 public class HtmlPrettyPrintWriter extends PrintWriter { 37 38 39 protected int _charsWritten = 0; 40 41 46 public HtmlPrettyPrintWriter(Writer writer) { 47 super(writer); 48 } 49 50 55 public void print(String output) { 56 57 ++_charsWritten; 58 59 if (output == null) { 60 super.print(output); 61 } else if (output.equals(".")) { 62 super.print("<font color=\"green\">.</font>"); 63 } else if (output.equals("S")) { 64 super.print("<font color=\"gray\">S</font>"); 65 } else if (output.equals("F")) { 66 super.print("<font color=\"red\">F</font>"); 67 } else if (output.equals("E")) { 68 super.print("<font color=\"red\">E</font>"); 69 } else { 70 super.print(output); 71 } 72 73 if ((_charsWritten % 5) == 0) { 74 super.print("<wbr>"); 75 } 76 77 } 78 79 } 80 | Popular Tags |