KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > mortbay > jetty > servlet > ServletOut


1 // ========================================================================
2
// $Id: ServletOut.java,v 1.7 2004/05/09 20:32:27 gregwilkins Exp $
3
// Copyright 2000-2004 Mort Bay Consulting Pty. Ltd.
4
// ------------------------------------------------------------------------
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
// ========================================================================
15

16 package org.mortbay.jetty.servlet;
17
18 import java.io.IOException JavaDoc;
19 import java.io.OutputStream JavaDoc;
20
21 import javax.servlet.ServletOutputStream JavaDoc;
22
23 import org.mortbay.util.IO;
24
25
26 class ServletOut extends ServletOutputStream JavaDoc
27 {
28     OutputStream JavaDoc _out;
29
30     /* ------------------------------------------------------------ */
31     ServletOut(OutputStream JavaDoc out)
32     {
33         _out=out;
34     }
35     
36     /* ------------------------------------------------------------ */
37     public void write(int ch)
38         throws IOException JavaDoc
39     {
40         _out.write(ch);
41     }
42     
43     /* ------------------------------------------------------------ */
44     public void write(byte[]b)
45         throws IOException JavaDoc
46     {
47         _out.write(b);
48     }
49     
50     /* ------------------------------------------------------------ */
51     public void write(byte[]b,int o,int l)
52         throws IOException JavaDoc
53     {
54         _out.write(b,o,l);
55     }
56
57     /* ------------------------------------------------------------ */
58     public void flush()
59         throws IOException JavaDoc
60     {
61         _out.flush();
62     }
63     
64     /* ------------------------------------------------------------ */
65     public void close()
66         throws IOException JavaDoc
67     {
68         super.close();
69         _out.close();
70     }
71     
72     /* ------------------------------------------------------------ */
73     public void disable()
74         throws IOException JavaDoc
75     {
76         _out=IO.getNullStream();
77     }
78
79     /* ------------------------------------------------------------ */
80     public void print(String JavaDoc s) throws IOException JavaDoc
81     {
82          if (s!=null) write(s.getBytes());
83     }
84
85     /* ------------------------------------------------------------ */
86     public void println(String JavaDoc s) throws IOException JavaDoc
87     {
88          if (s!=null) write(s.getBytes());
89          write(IO.CRLF_BYTES);
90     }
91 }
92
Popular Tags