1 15 package org.apache.tapestry.markup; 16 17 import java.io.PrintWriter ; 18 19 import org.apache.tapestry.util.text.ICharacterTranslator; 20 21 29 public class MarkupFilterUtils 30 { 31 public static void print(PrintWriter writer, char[] data, int offset, int length, 32 boolean escapeQuotes, ICharacterTranslator translator) 33 { 34 StringBuffer buffer = new StringBuffer (length); 35 36 for (int i = 0; i < length; i++) 37 { 38 char ch = data[offset + i]; 39 40 if (ch == '"' && !escapeQuotes) 41 { 42 buffer.append(ch); 43 continue; 44 } 45 46 String translated = translator.translate(ch); 47 48 if (translated == null) 49 { 50 buffer.append(ch); 51 continue; 52 } 53 54 buffer.append(translated); 55 } 56 57 62 writer.print(buffer.toString()); 63 } 64 } | Popular Tags |