001
014
015 package com.liferay.taglib;
016
017 import com.liferay.portal.kernel.io.unsync.UnsyncStringWriter;
018 import com.liferay.portal.kernel.util.StringBundler;
019
020 import java.io.IOException;
021 import java.io.Reader;
022 import java.io.Writer;
023
024 import javax.servlet.jsp.JspWriter;
025 import javax.servlet.jsp.tagext.BodyContent;
026
027
030 public class BodyContentWrapper extends BodyContent
031 implements com.liferay.portal.kernel.servlet.taglib.BodyContentWrapper {
032
033 public BodyContentWrapper(
034 BodyContent bodyContent, UnsyncStringWriter unsyncStringWriter) {
035
036 super(bodyContent.getEnclosingWriter());
037
038 _bodyContent = bodyContent;
039 _unsyncStringWriter = unsyncStringWriter;
040 }
041
042 @Override
043 public Writer append(char c) throws IOException {
044 return _bodyContent.append(c);
045 }
046
047 @Override
048 public Writer append(CharSequence charSequence) throws IOException {
049 return _bodyContent.append(charSequence);
050 }
051
052 @Override
053 public Writer append(CharSequence charSequence, int start, int end)
054 throws IOException {
055
056 return _bodyContent.append(charSequence, start, end);
057 }
058
059 @Override
060 public void clear() throws IOException {
061 _bodyContent.clear();
062 }
063
064 @Override
065 public void clearBody() {
066 _unsyncStringWriter.reset();
067 }
068
069 @Override
070 public void clearBuffer() {
071 _unsyncStringWriter.reset();
072 }
073
074 @Override
075 public void close() throws IOException {
076 _bodyContent.close();
077 }
078
079 @Override
080 public void flush() throws IOException {
081 _bodyContent.flush();
082 }
083
084 @Override
085 public int getBufferSize() {
086 return _bodyContent.getBufferSize();
087 }
088
089 @Override
090 public JspWriter getEnclosingWriter() {
091 return _bodyContent.getEnclosingWriter();
092 }
093
094 @Override
095 public Reader getReader() {
096 return _bodyContent.getReader();
097 }
098
099 @Override
100 public int getRemaining() {
101 return _bodyContent.getRemaining();
102 }
103
104 @Override
105 public String getString() {
106 return _unsyncStringWriter.toString();
107 }
108
109 @Override
110 public StringBundler getStringBundler() {
111 return _unsyncStringWriter.getStringBundler();
112 }
113
114 @Override
115 public boolean isAutoFlush() {
116 return _bodyContent.isAutoFlush();
117 }
118
119 @Override
120 public void newLine() throws IOException {
121 _bodyContent.newLine();
122 }
123
124 @Override
125 public void print(boolean b) throws IOException {
126 _bodyContent.print(b);
127 }
128
129 @Override
130 public void print(char c) throws IOException {
131 _bodyContent.print(c);
132 }
133
134 @Override
135 public void print(char[] chars) throws IOException {
136 _bodyContent.print(chars);
137 }
138
139 @Override
140 public void print(double d) throws IOException {
141 _bodyContent.print(d);
142 }
143
144 @Override
145 public void print(float f) throws IOException {
146 _bodyContent.print(f);
147 }
148
149 @Override
150 public void print(int i) throws IOException {
151 _bodyContent.print(i);
152 }
153
154 @Override
155 public void print(long l) throws IOException {
156 _bodyContent.print(l);
157 }
158
159 @Override
160 public void print(Object object) throws IOException {
161 _bodyContent.print(object);
162 }
163
164 @Override
165 public void print(String string) throws IOException {
166 _bodyContent.print(string);
167 }
168
169 @Override
170 public void println() throws IOException {
171 _bodyContent.println();
172 }
173
174 @Override
175 public void println(boolean b) throws IOException {
176 _bodyContent.println(b);
177 }
178
179 @Override
180 public void println(char c) throws IOException {
181 _bodyContent.println(c);
182 }
183
184 @Override
185 public void println(char[] chars) throws IOException {
186 _bodyContent.println(chars);
187 }
188
189 @Override
190 public void println(double d) throws IOException {
191 _bodyContent.println(d);
192 }
193
194 @Override
195 public void println(float f) throws IOException {
196 _bodyContent.println(f);
197 }
198
199 @Override
200 public void println(int i) throws IOException {
201 _bodyContent.println(i);
202 }
203
204 @Override
205 public void println(long l) throws IOException {
206 _bodyContent.println(l);
207 }
208
209 @Override
210 public void println(Object object) throws IOException {
211 _bodyContent.println(object);
212 }
213
214 @Override
215 public void println(String string) throws IOException {
216 _bodyContent.println(string);
217 }
218
219 @Override
220 public void write(char[] chars) throws IOException {
221 _bodyContent.write(chars);
222 }
223
224 @Override
225 public void write(char[] chars, int offset, int length) throws IOException {
226 _bodyContent.write(chars, offset, length);
227 }
228
229 @Override
230 public void write(int c) throws IOException {
231 _bodyContent.write(c);
232 }
233
234 @Override
235 public void write(String string) throws IOException {
236 _bodyContent.write(string);
237 }
238
239 @Override
240 public void write(String string, int offset, int length)
241 throws IOException {
242
243 _bodyContent.write(string, offset, length);
244 }
245
246 @Override
247 public void writeOut(Writer writer) throws IOException {
248 _bodyContent.writeOut(writer);
249 }
250
251 private final BodyContent _bodyContent;
252 private final UnsyncStringWriter _unsyncStringWriter;
253
254 }