KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > coyote > tomcat5 > CoyoteOutputStream


1
2
3 /*
4  * The contents of this file are subject to the terms
5  * of the Common Development and Distribution License
6  * (the "License"). You may not use this file except
7  * in compliance with the License.
8  *
9  * You can obtain a copy of the license at
10  * glassfish/bootstrap/legal/CDDLv1.0.txt or
11  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
12  * See the License for the specific language governing
13  * permissions and limitations under the License.
14  *
15  * When distributing Covered Code, include this CDDL
16  * HEADER in each file and include the License file at
17  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
18  * add the following below this CDDL HEADER, with the
19  * fields enclosed by brackets "[]" replaced with your
20  * own identifying information: Portions Copyright [yyyy]
21  * [name of copyright owner]
22  *
23  * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24  *
25  * Portions Copyright Apache Software Foundation.
26  */

27
28
29 package org.apache.coyote.tomcat5;
30
31 import java.io.IOException JavaDoc;
32
33 import javax.servlet.ServletOutputStream JavaDoc;
34
35 import org.apache.coyote.Response;
36
37 /**
38  * Coyote implementation of the servlet output stream.
39  *
40  * @author Costin Manolache
41  * @author Remy Maucherat
42  */

43 public class CoyoteOutputStream
44     extends ServletOutputStream JavaDoc {
45
46
47     // ----------------------------------------------------- Instance Variables
48

49
50     protected OutputBuffer ob;
51
52
53     // ----------------------------------------------------------- Constructors
54

55
56     // BEGIN S1AS 6175642
57
/*
58     protected CoyoteOutputStream(OutputBuffer ob) {
59     */

60     public CoyoteOutputStream(OutputBuffer ob) {
61     // END S1AS 6175642
62
this.ob = ob;
63     }
64     
65     
66     // --------------------------------------------------------- Public Methods
67

68
69     /**
70     * Prevent cloning the facade.
71     */

72     protected Object JavaDoc clone()
73         throws CloneNotSupportedException JavaDoc {
74         throw new CloneNotSupportedException JavaDoc();
75     }
76
77   
78     // -------------------------------------------------------- Package Methods
79

80
81     /**
82      * Clear facade.
83      */

84     void clear() {
85         ob = null;
86     }
87
88
89     // --------------------------------------------------- OutputStream Methods
90

91
92     public void write(int i)
93         throws IOException JavaDoc {
94         ob.writeByte(i);
95     }
96
97
98     public void write(byte[] b)
99         throws IOException JavaDoc {
100         write(b, 0, b.length);
101     }
102
103
104     public void write(byte[] b, int off, int len)
105         throws IOException JavaDoc {
106         ob.write(b, off, len);
107     }
108
109
110     /**
111      * Will send the buffer to the client.
112      */

113     public void flush()
114         throws IOException JavaDoc {
115         ob.flush();
116     }
117
118
119     public void close()
120         throws IOException JavaDoc {
121         ob.close();
122     }
123
124
125     // -------------------------------------------- ServletOutputStream Methods
126

127
128     public void print(String JavaDoc s)
129         throws IOException JavaDoc {
130         ob.write(s);
131     }
132
133
134 }
135
136
Popular Tags