1 5 package com.opensymphony.webwork.views.jsp.ui; 6 7 import javax.servlet.jsp.JspWriter ; 8 import javax.servlet.jsp.tagext.BodyContent ; 9 import java.io.IOException ; 10 import java.io.Reader ; 11 import java.io.StringReader ; 12 import java.io.Writer ; 13 14 15 20 public class WebWorkBodyContent extends BodyContent { 21 23 private StringBuffer buffer = new StringBuffer (); 24 25 27 public WebWorkBodyContent(JspWriter jspWriter) { 28 super(jspWriter); 29 } 30 31 33 public Reader getReader() { 34 return new StringReader (buffer.toString()); 35 } 36 37 public int getRemaining() { 38 return 0; 39 } 40 41 public String getString() { 42 return buffer.toString(); 43 } 44 45 public void clear() throws IOException { 46 buffer = new StringBuffer (); 47 } 48 49 public void clearBuffer() throws IOException { 50 clear(); 51 } 52 53 public void close() throws IOException { 54 buffer = null; 55 } 56 57 public void newLine() throws IOException { 58 buffer.append("\n"); 59 } 60 61 public void print(boolean b) throws IOException { 62 buffer.append(b); 63 } 64 65 public void print(char c) throws IOException { 66 buffer.append(c); 67 } 68 69 public void print(int i) throws IOException { 70 buffer.append(i); 71 } 72 73 public void print(long l) throws IOException { 74 buffer.append(l); 75 } 76 77 public void print(float v) throws IOException { 78 buffer.append(v); 79 } 80 81 public void print(double v) throws IOException { 82 buffer.append(v); 83 } 84 85 public void print(char[] chars) throws IOException { 86 buffer.append(chars); 87 } 88 89 public void print(String s) throws IOException { 90 buffer.append(s); 91 } 92 93 public void print(Object o) throws IOException { 94 buffer.append(o); 95 } 96 97 public void println() throws IOException { 98 newLine(); 99 } 100 101 public void println(boolean b) throws IOException { 102 print(b); 103 newLine(); 104 } 105 106 public void println(char c) throws IOException { 107 print(c); 108 newLine(); 109 } 110 111 public void println(int i) throws IOException { 112 print(i); 113 newLine(); 114 } 115 116 public void println(long l) throws IOException { 117 print(l); 118 newLine(); 119 } 120 121 public void println(float v) throws IOException { 122 print(v); 123 newLine(); 124 } 125 126 public void println(double v) throws IOException { 127 print(v); 128 newLine(); 129 } 130 131 public void println(char[] chars) throws IOException { 132 print(chars); 133 newLine(); 134 } 135 136 public void println(String s) throws IOException { 137 print(s); 138 newLine(); 139 } 140 141 public void println(Object o) throws IOException { 142 print(o); 143 newLine(); 144 } 145 146 154 public void write(char[] cbuf, int off, int len) throws IOException { 155 buffer.append(cbuf, off, len); 156 } 157 158 public void writeOut(Writer writer) throws IOException { 159 writer.write(buffer.toString()); 160 } 161 } 162 | Popular Tags |