001
014
015 package com.liferay.portal.kernel.servlet;
016
017 import com.liferay.portal.kernel.util.StringPool;
018
019 import java.io.IOException;
020 import java.io.Writer;
021
022 import javax.servlet.jsp.JspWriter;
023
024
027 public class PipingJspWriter extends JspWriter {
028
029 public PipingJspWriter(Writer writer) {
030 super(NO_BUFFER, false);
031
032 _writer = writer;
033 }
034
035 @Override
036 public void clear() throws IOException {
037 throw new IOException();
038 }
039
040 @Override
041 public void clearBuffer() {
042 }
043
044 @Override
045 public void close() throws IOException {
046 _writer.close();
047 }
048
049 @Override
050 public void flush() throws IOException {
051 _writer.flush();
052 }
053
054 @Override
055 public int getRemaining() {
056 return 0;
057 }
058
059 @Override
060 public void newLine() throws IOException {
061 _writer.write(_LINE_SEPARATOR);
062 }
063
064 @Override
065 public void print(boolean b) throws IOException {
066 if (b) {
067 _writer.write(StringPool.TRUE);
068 }
069 else {
070 _writer.write(StringPool.FALSE);
071 }
072 }
073
074 @Override
075 public void print(char c) throws IOException {
076 _writer.write(c);
077 }
078
079 @Override
080 public void print(char[] chars) throws IOException {
081 _writer.write(chars);
082 }
083
084 @Override
085 public void print(double d) throws IOException {
086 _writer.write(String.valueOf(d));
087 }
088
089 @Override
090 public void print(float f) throws IOException {
091 _writer.write(String.valueOf(f));
092 }
093
094 @Override
095 public void print(int i) throws IOException {
096 _writer.write(String.valueOf(i));
097 }
098
099 @Override
100 public void print(long l) throws IOException {
101 _writer.write(String.valueOf(l));
102 }
103
104 @Override
105 public void print(Object object) throws IOException {
106 _writer.write(String.valueOf(object));
107 }
108
109 @Override
110 public void print(String string) throws IOException {
111 if (string == null) {
112 string = StringPool.NULL;
113 }
114
115 _writer.write(string);
116 }
117
118 @Override
119 public void println() throws IOException {
120 _writer.write(_LINE_SEPARATOR);
121 }
122
123 @Override
124 public void println(boolean b) throws IOException {
125 if (b) {
126 _writer.write(StringPool.TRUE);
127 }
128 else {
129 _writer.write(StringPool.FALSE);
130 }
131
132 _writer.write(_LINE_SEPARATOR);
133 }
134
135 @Override
136 public void println(char c) throws IOException {
137 _writer.write(c);
138 _writer.write(_LINE_SEPARATOR);
139 }
140
141 @Override
142 public void println(char[] chars) throws IOException {
143 _writer.write(chars);
144 _writer.write(_LINE_SEPARATOR);
145 }
146
147 @Override
148 public void println(double d) throws IOException {
149 _writer.write(String.valueOf(d));
150 _writer.write(_LINE_SEPARATOR);
151 }
152
153 @Override
154 public void println(float f) throws IOException {
155 _writer.write(String.valueOf(f));
156 _writer.write(_LINE_SEPARATOR);
157 }
158
159 @Override
160 public void println(int i) throws IOException {
161 _writer.write(String.valueOf(i));
162 _writer.write(_LINE_SEPARATOR);
163 }
164
165 @Override
166 public void println(long l) throws IOException {
167 _writer.write(String.valueOf(l));
168 _writer.write(_LINE_SEPARATOR);
169 }
170
171 @Override
172 public void println(Object object) throws IOException {
173 _writer.write(String.valueOf(object));
174 _writer.write(_LINE_SEPARATOR);
175 }
176
177 @Override
178 public void println(String string) throws IOException {
179 if (string == null) {
180 string = StringPool.NULL;
181 }
182
183 _writer.write(string);
184 _writer.write(_LINE_SEPARATOR);
185 }
186
187 @Override
188 public void write(char[] chars) throws IOException {
189 _writer.write(chars);
190 }
191
192 @Override
193 public void write(char[] chars, int offset, int length) throws IOException {
194 _writer.write(chars, offset, length);
195 }
196
197 @Override
198 public void write(int c) throws IOException {
199 _writer.write(c);
200 }
201
202 @Override
203 public void write(String string) throws IOException {
204 _writer.write(string);
205 }
206
207 @Override
208 public void write(String string, int offset, int length)
209 throws IOException {
210
211 _writer.write(string, offset, length);
212 }
213
214 private static final String _LINE_SEPARATOR = System.getProperty(
215 "line.separator");
216
217 private Writer _writer;
218
219 }