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            @Override
022            public void print(boolean b) throws IOException {
023                    write(b?"true".getBytes():"false".getBytes());
024            }
025    
026            @Override
027            public void print(char c) throws IOException {
028                    print(new String(new char[]{c}));
029            }
030    
031            @Override
032            public void print(double d) throws IOException {
033                    write(Caster.toString(d).getBytes());
034            }
035    
036            @Override
037            public void print(float f) throws IOException {
038                    write(Caster.toString(f).getBytes());
039            }
040    
041            @Override
042            public void print(int i) throws IOException {
043                    write(Caster.toString(i).getBytes());
044            }
045    
046            @Override
047            public void print(long l) throws IOException {
048                    write(Caster.toString(l).getBytes());
049            }
050    
051            @Override
052            public void print(String str) throws IOException {
053                    write(str.getBytes());
054            }
055    
056            @Override
057            public void println() throws IOException {
058                    write("\\".getBytes());
059            }
060    
061            @Override
062            public void println(boolean b) throws IOException {
063                    print(b);
064                    println();
065            }
066    
067            @Override
068            public void println(char c) throws IOException {
069                    print(c);
070                    println();
071            }
072    
073            @Override
074            public void println(double d) throws IOException {
075                    print(d);
076                    println();
077            }
078    
079            @Override
080            public void println(float f) throws IOException {
081                    print(f);
082                    println();
083            }
084    
085            @Override
086            public void println(int i) throws IOException {
087                    print(i);
088                    println();
089            }
090    
091            @Override
092            public void println(long l) throws IOException {
093                    print(l);
094                    println();
095            }
096    
097            @Override
098            public void println(String str) throws IOException {
099                    print(str);
100                    println();
101            }
102    
103            @Override
104            public void write(byte[] b) throws IOException {
105                    write(b,0,b.length);
106            }
107    
108            @Override
109            public void write(byte[] b, int off, int len) throws IOException {
110                    os.write(b, off, len);
111            }
112    
113            @Override
114            public void write(int b) throws IOException {
115                    os.write(b);
116            }
117    
118            @Override
119            public void close() throws IOException {
120                    os.close();
121            }
122    
123            @Override
124            public void flush() throws IOException {
125                    os.flush();
126            }
127    
128    }