1 23 package com.sun.enterprise.diagnostics.report.html; 24 25 import java.io.File ; 26 import java.io.FileWriter ; 27 import java.io.IOException ; 28 import java.io.Writer ; 29 30 33 public class HTMLText implements Text { 34 35 36 39 private String text = null; 40 41 42 46 public HTMLText(String text) { 47 setValue(text); 48 } 49 50 51 53 public String getValue() { 54 return text; 55 } 56 57 58 60 public void setValue(String text) { 61 if (text == null) { 62 throw new NullPointerException ("Text is null."); 63 } 64 this.text = text; 65 } 66 67 68 71 public String toString() { 72 return Escape.getInstance().encodeEntities(text, ""); 73 } 74 75 76 78 public void write(Writer output) throws IOException { 79 output.append(toString()); 80 output.flush(); 81 } 82 83 84 86 public void write(File file) throws IOException { 87 FileWriter fw = new FileWriter (file); 88 write(fw); 89 fw.close(); 90 } 91 92 } 93 | Popular Tags |