00001
package com.quadcap.http.server22;
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
import java.io.IOException;
00042
00043
import com.quadcap.io.IO;
00044
00045
00046
00047
00048
00049
00050
00051
00052 public class JspWriter extends javax.servlet.jsp.
JspWriter {
00053 HttpOutputStream out;
00054 boolean closed =
false;
00055 byte[]
buf = null;
00056 static String
lineSep = System.getProperty(
"line.separator");
00057
00058 public JspWriter(
int bufferSize,
boolean autoFlush) {
00059 super(bufferSize, autoFlush);
00060 }
00061
00062 final void setHttpOutputStream(
HttpOutputStream out) {
00063
this.out = out;
00064 }
00065
00066 public final void newLine() throws IOException {
00067
print(
lineSep);
00068 }
00069
00070 public final void print(
boolean b)
throws IOException {
00071 print(b ?
"true" :
"false");
00072 }
00073
00074 public final void print(
char c)
throws IOException {
00075 print(String.valueOf(c));
00076 }
00077
00078 public final void print(
int i)
throws IOException {
00079 print(String.valueOf(i));
00080 }
00081
00082 public final void print(
long l)
throws IOException {
00083 print(String.valueOf(l));
00084 }
00085
00086 public final void print(
float f)
throws IOException {
00087 print(String.valueOf(f));
00088 }
00089
00090 public final void print(
double d)
throws IOException {
00091 print(String.valueOf(d));
00092 }
00093
00094 public final void print(
char[] ch)
throws IOException {
00095
write(ch, 0, ch.length);
00096 }
00097
00098 public final void print(String s)
throws IOException {
00099
final int len = s.length();
00100
if (
buf == null ||
buf.length < len) {
00101
buf =
new byte[len];
00102 }
00103
for (
int i = 0; i < len; i++) {
00104
buf[i] = (byte)(s.charAt(i) & 0xff);
00105 }
00106
out.
write(
buf, 0, len);
00107 }
00108
00109 public final void write(String s)
throws IOException {
00110
IO.write(
out, s);
00111 }
00112
00113 public final void write(String s,
int off,
int len)
throws IOException {
00114
for (
int i = 0; i < len; i++) {
00115
out.
write(s.charAt(off + i) & 0xff);
00116 }
00117 }
00118
00119 public final void print(Object obj)
throws IOException {
00120 print(obj.toString());
00121 }
00122
00123 public final void println() throws IOException {
00124 print(
lineSep);
00125 }
00126
00127 public final void println(
boolean b)
throws IOException {
00128 print(b);
00129
println();
00130 }
00131
00132 public final void println(
char c)
throws IOException {
00133 print(c);
00134
println();
00135 }
00136
00137 public final void println(
int i)
throws IOException {
00138 print(i);
00139
println();
00140 }
00141
00142 public final void println(
long l)
throws IOException {
00143 print(l);
00144
println();
00145 }
00146
00147 public final void println(
float f)
throws IOException {
00148 print(f);
00149
println();
00150 }
00151
00152 public final void println(
double d)
throws IOException {
00153 print(d);
00154
println();
00155 }
00156
00157 public final void println(
char[] ch)
throws IOException {
00158 print(ch);
00159
println();
00160 }
00161
00162 public final void println(String s)
throws IOException {
00163 print(s);
00164
println();
00165 }
00166
00167 public final void println(Object obj)
throws IOException {
00168 print(obj);
00169
println();
00170 }
00171
00172 public final void write(
char[] ch,
int off,
int len)
throws IOException {
00173
if (
closed)
throw new IOException(
"JspWriter closed");
00174
for (
int i = 0; i < len; i++) {
00175
out.
write(ch[off + i]);
00176 }
00177 }
00178
00179 public final void clear() throws IOException {
00180
try {
00181
out.
reset();
00182 }
catch (IllegalStateException e) {
00183
throw new IOException(e.toString());
00184 }
00185 }
00186
00187 public final void clearBuffer() throws IOException {
00188
try {
00189
out.
reset();
00190 }
catch (IllegalStateException e) {}
00191 }
00192
00193 public final void flush() throws IOException {
00194
out.
flush();
00195 }
00196
00197 public final void close() throws IOException {
00198
if (!
closed) {
00199
out.
close();
00200
closed =
true;
00201 }
00202 }
00203
00204 public final int getRemaining() {
00205
return out.
getRemaining();
00206 }
00207
00208 public final void setBufferSize(
int bufferSize) {
00209
out.
setBufferSize(bufferSize);
00210 }
00211
00212 public final void setAutoFlush(
boolean autoFlush) {
00213
out.
setAutoFlush(autoFlush);
00214 }
00215 }
00216