001    package railo.runtime.net.http;
002    
003    import java.io.IOException;
004    import java.io.OutputStream;
005    
006    import javax.servlet.ServletOutputStream;
007    
008    import railo.runtime.op.Caster;
009    
010    public final class ServletOutputStreamDummy extends ServletOutputStream {
011    
012            private OutputStream os;
013    
014            //private HttpServletResponseDummy rsp;
015            //private ByteArrayOutputStream baos;
016    
017            public ServletOutputStreamDummy(OutputStream os) {
018                    this.os=os;
019            }
020            
021            /**
022             *
023             * @see javax.servlet.ServletOutputStream#print(boolean)
024             */
025            public void print(boolean b) throws IOException {
026                    write(b?"true".getBytes():"false".getBytes());
027            }
028    
029            /**
030             *
031             * @see javax.servlet.ServletOutputStream#print(char)
032             */
033            public void print(char c) throws IOException {
034                    print(new String(new char[]{c}));
035            }
036    
037            /**
038             *
039             * @see javax.servlet.ServletOutputStream#print(double)
040             */
041            public void print(double d) throws IOException {
042                    write(Caster.toString(d).getBytes());
043            }
044    
045            /**
046             *
047             * @see javax.servlet.ServletOutputStream#print(float)
048             */
049            public void print(float f) throws IOException {
050                    write(Caster.toString(f).getBytes());
051            }
052    
053            /**
054             *
055             * @see javax.servlet.ServletOutputStream#print(int)
056             */
057            public void print(int i) throws IOException {
058                    write(Caster.toString(i).getBytes());
059            }
060    
061            /**
062             *
063             * @see javax.servlet.ServletOutputStream#print(long)
064             */
065            public void print(long l) throws IOException {
066                    write(Caster.toString(l).getBytes());
067            }
068    
069            /**
070             *
071             * @see javax.servlet.ServletOutputStream#print(java.lang.String)
072             */
073            public void print(String str) throws IOException {
074                    write(str.getBytes());
075            }
076    
077            /**
078             *
079             * @see javax.servlet.ServletOutputStream#println()
080             */
081            public void println() throws IOException {
082                    write("\\".getBytes());
083            }
084    
085            /**
086             *
087             * @see javax.servlet.ServletOutputStream#println(boolean)
088             */
089            public void println(boolean b) throws IOException {
090                    print(b);
091                    println();
092            }
093    
094            /**
095             *
096             * @see javax.servlet.ServletOutputStream#println(char)
097             */
098            public void println(char c) throws IOException {
099                    print(c);
100                    println();
101            }
102    
103            /**
104             *
105             * @see javax.servlet.ServletOutputStream#println(double)
106             */
107            public void println(double d) throws IOException {
108                    print(d);
109                    println();
110            }
111    
112            /**
113             *
114             * @see javax.servlet.ServletOutputStream#println(float)
115             */
116            public void println(float f) throws IOException {
117                    print(f);
118                    println();
119            }
120    
121            /**
122             *
123             * @see javax.servlet.ServletOutputStream#println(int)
124             */
125            public void println(int i) throws IOException {
126                    print(i);
127                    println();
128            }
129    
130            /**
131             *
132             * @see javax.servlet.ServletOutputStream#println(long)
133             */
134            public void println(long l) throws IOException {
135                    print(l);
136                    println();
137            }
138    
139            /**
140             *
141             * @see javax.servlet.ServletOutputStream#println(java.lang.String)
142             */
143            public void println(String str) throws IOException {
144                    print(str);
145                    println();
146            }
147    
148            /**
149             *
150             * @see java.io.OutputStream#write(byte[])
151             */
152            public void write(byte[] b) throws IOException {
153                    write(b,0,b.length);
154            }
155    
156            /**
157             * @see java.io.OutputStream#write(byte[], int, int)
158             */
159            public void write(byte[] b, int off, int len) throws IOException {
160                    os.write(b, off, len);
161            }
162    
163            /**
164             * @see java.io.OutputStream#write(int)
165             */
166            public void write(int b) throws IOException {
167                    os.write(b);
168            }
169    
170            /**
171             *
172             * @see java.io.OutputStream#close()
173             */
174            public void close() throws IOException {
175                    os.close();
176            }
177    
178            /**
179             *
180             * @see java.io.OutputStream#flush()
181             */
182            public void flush() throws IOException {
183                    os.flush();
184            }
185    
186    }