Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/prolifics/servlet/FilterServletOutputStream.java


1   /*************************************************/
2   /*  Copyright (c) 1999         */
3   /*      by         */
4   /*  JYACC, Inc., New York NY USA     */
5   /*  and contributors.         */
6   /*  Use of this program is governed by the   */
7   /*  JYACC Public License Version 1.0, a copy of   */
8   /*  which can be obtained at       */
9   /*  http://www.possl.org/jyacc-license.html   */
10  /*************************************************/
11  
12  /* @(#)FilterServletOutputStream.java  77.1 99/04/22 15:03:04 */
13  
14  package com.prolifics.servlet;
15  import java.io.*;
16  import javax.servlet.*;
17  import javax.servlet.http.*;
18  
19  /**
20   *
21   * @author    Prolifics
22   * @version    @(#)FilterServletOutputStream.java  77.1 99/04/22 15:03:04
23   * @since   JDK1.0
24   */
25  public
26  class FilterServletOutputStream extends ServletOutputStream
27  {
28    private static String sccsid = "@(#)FilterServletOutputStream.java  77.1 99/04/22 15:03:04";
29    protected OutputStream out;
30  
31    public FilterServletOutputStream(OutputStream out)
32    {
33      this.out = out;
34    }
35  
36    public FilterServletOutputStream(ServletOutputStream out)
37    {
38      this.out = out;
39    }
40  
41    public void write(int val) throws IOException
42    {
43      out.write(val);
44    }
45  
46    public void write(byte buf[]) throws IOException
47    {
48      write(buf, 0, buf.length);
49    }
50  
51    public void write(byte buf[], int off, int len) throws IOException
52    {
53      out.write(buf, off, len);
54    }
55  
56    public void flush() throws IOException
57    {
58      out.flush();
59    }
60  
61    public void close() throws IOException
62    {
63      try
64      {
65        flush();
66      }
67      catch (IOException ignored)
68      {
69      }
70      finally
71      {
72        out.close();
73      }
74    }
75  
76    public void print(String sval) throws IOException
77    {
78      if (out instanceof ServletOutputStream)
79      {
80        ServletOutputStream sOut = (ServletOutputStream) out;
81        sOut.print(sval);
82      }
83      else
84      {
85        super.print(sval);
86      }
87    }
88  
89    public void print(boolean bval) throws IOException
90    {
91      if (out instanceof ServletOutputStream)
92      {
93        ServletOutputStream sOut = (ServletOutputStream) out;
94        sOut.print(bval);
95      }
96      else
97      {
98        super.print(bval);
99      }
100   }
101 
102   public void print(char cval) throws IOException
103   {
104     if (out instanceof ServletOutputStream)
105     {
106       ServletOutputStream sOut = (ServletOutputStream) out;
107       sOut.print(cval);
108     }
109     else
110     {
111       super.print(cval);
112     }
113   }
114 
115   public void print(int ival) throws IOException
116   {
117     if (out instanceof ServletOutputStream)
118     {
119       ServletOutputStream sOut = (ServletOutputStream) out;
120       sOut.print(ival);
121     }
122     else
123     {
124       super.print(ival);
125     }
126   }
127 
128   public void print(long lval) throws IOException
129   {
130     if (out instanceof ServletOutputStream)
131     {
132       ServletOutputStream sOut = (ServletOutputStream) out;
133       sOut.print(lval);
134     }
135     else
136     {
137       super.print(lval);
138     }
139   }
140 
141   public void print(float fval) throws IOException
142   {
143     if (out instanceof ServletOutputStream)
144     {
145       ServletOutputStream sOut = (ServletOutputStream) out;
146       sOut.print(fval);
147     }
148     else
149     {
150       super.print(fval);
151     }
152   }
153 
154   public void print(double dval) throws IOException
155   {
156     if (out instanceof ServletOutputStream)
157     {
158       ServletOutputStream sOut = (ServletOutputStream) out;
159       sOut.print(dval);
160     }
161     else
162     {
163       super.print(dval);
164     }
165   }
166 
167   public void println( ) throws IOException
168   {
169     if (out instanceof ServletOutputStream)
170     {
171       ServletOutputStream sOut = (ServletOutputStream) out;
172       sOut.println();
173     }
174     else
175     {
176       super.println();
177     }
178   }
179 
180   public void println(String sval) throws IOException
181   {
182     if (out instanceof ServletOutputStream)
183     {
184       ServletOutputStream sOut = (ServletOutputStream) out;
185       sOut.println(sval);
186     }
187     else
188     {
189       super.println(sval);
190     }
191   }
192 
193   public void println(boolean bval) throws IOException
194   {
195     if (out instanceof ServletOutputStream)
196     {
197       ServletOutputStream sOut = (ServletOutputStream) out;
198       sOut.println(bval);
199     }
200     else
201     {
202       super.println(bval);
203     }
204   }
205 
206   public void println(char cval) throws IOException
207   {
208     if (out instanceof ServletOutputStream)
209     {
210       ServletOutputStream sOut = (ServletOutputStream) out;
211       sOut.println(cval);
212     }
213     else
214     {
215       super.println(cval);
216     }
217   }
218 
219   public void println(int ival) throws IOException
220   {
221     if (out instanceof ServletOutputStream)
222     {
223       ServletOutputStream sOut = (ServletOutputStream) out;
224       sOut.println(ival);
225     }
226     else
227     {
228       super.println(ival);
229     }
230   }
231 
232   public void println(long lval) throws IOException
233   {
234     if (out instanceof ServletOutputStream)
235     {
236       ServletOutputStream sOut = (ServletOutputStream) out;
237       sOut.println(lval);
238     }
239     else
240     {
241       super.println(lval);
242     }
243   }
244 
245   public void println(float fval) throws IOException
246   {
247     if (out instanceof ServletOutputStream)
248     {
249       ServletOutputStream sOut = (ServletOutputStream) out;
250       sOut.println(fval);
251     }
252     else
253     {
254       super.println(fval);
255     }
256   }
257 
258   public void println(double dval) throws IOException
259   {
260     if (out instanceof ServletOutputStream)
261     {
262       ServletOutputStream sOut = (ServletOutputStream) out;
263       sOut.println(dval);
264     }
265     else
266     {
267       super.println(dval);
268     }
269   }
270 }