1 17 18 package com.finalist.jag.template; 19 20 27 public class TemplateTextBlock { 28 29 30 private StringBuffer buffer; 31 32 33 private String filePath; 34 35 36 43 public TemplateTextBlock(String s) { 44 set(s); 45 } 46 47 54 public TemplateTextBlock(TemplateTextBlock c) { 55 56 if ((c != null) && (c.buffer != null)) { 57 this.buffer = new StringBuffer (new String (c.buffer)); 58 } 59 } 60 61 66 public void set() { 67 buffer = new StringBuffer (); 68 } 69 70 77 public void set(String s) { 78 buffer = new StringBuffer (s); 79 } 80 81 88 public void append(String s) { 89 buffer.append(s); 90 } 91 92 99 public void append(StringBuffer s) { 100 buffer.append(s.toString()); 101 } 102 103 110 public String getText() { 111 return new String (buffer); 112 } 113 114 121 public String toString() { 122 return buffer.toString(); 123 } 124 125 132 public boolean isEmpty() { 133 return buffer.length() < 1; 134 } 135 136 143 public void setFile(String path) { 144 this.filePath = path; 145 } 146 147 154 public String getFile() { 155 return filePath; 156 } 157 158 165 public boolean newFile() { 166 return (filePath != null) && (filePath.length() > 0); 167 } 168 } | Popular Tags |