View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.tobago.internal.mock.servlet;
21  
22  import javax.servlet.jsp.JspWriter;
23  import java.io.IOException;
24  import java.io.PrintWriter;
25  
26  public class MockJspWriter extends JspWriter {
27  
28    private PrintWriter out;
29  
30    public MockJspWriter(final PrintWriter out) {
31      super(100, true);
32      this.out = out;
33    }
34  
35    public boolean checkError() {
36      return out.checkError();
37    }
38  
39    public void print(final boolean b) {
40      out.print(b);
41    }
42  
43    public void print(final char c) {
44      out.print(c);
45    }
46  
47    public void print(final int i) {
48      out.print(i);
49    }
50  
51    public void print(final long l) {
52      out.print(l);
53    }
54  
55    public void print(final float f) {
56      out.print(f);
57    }
58  
59    public void print(final double d) {
60      out.print(d);
61    }
62  
63    public void print(final char[] s) {
64      out.print(s);
65    }
66  
67    public void print(final String s) {
68      out.print(s);
69    }
70  
71    public void print(final Object obj) {
72      out.print(obj);
73    }
74  
75    public void println() {
76      out.println();
77    }
78  
79    public void println(final boolean x) {
80      out.println(x);
81    }
82  
83    public void println(final char x) {
84      out.println(x);
85    }
86  
87    public void println(final int x) {
88      out.println(x);
89    }
90  
91    public void println(final long x) {
92      out.println(x);
93    }
94  
95    public void println(final float x) {
96      out.println(x);
97    }
98  
99    public void println(final double x) {
100     out.println(x);
101   }
102 
103   public void println(final char[] x) {
104     out.println(x);
105   }
106 
107   public void println(final String x) {
108     out.println(x);
109   }
110 
111   public void println(final Object x) {
112     out.println(x);
113   }
114 
115   public void write(final int c) throws IOException {
116     out.write(c);
117   }
118 
119   public void write(final char[] cbuf) throws IOException {
120     out.write(cbuf);
121   }
122 
123   public void write(final String str) throws IOException {
124     out.write(str);
125   }
126 
127   public void write(final char[] cbuf, final int off, final int len) throws IOException {
128     out.write(cbuf, off, len);
129   }
130 
131   public void write(final String str, final int off, final int len) throws IOException {
132     out.write(str, off, len);
133   }
134 
135   public void flush() throws IOException {
136     out.flush();
137   }
138 
139   public void close() throws IOException {
140     out.close();
141   }
142 
143   public void clear() throws IOException {
144   }
145 
146   public void clearBuffer() throws IOException {
147   }
148 
149   public int getRemaining() {
150     return 0;
151   }
152 
153   public void newLine() throws IOException {
154     print(System.getProperty("line.separator"));
155   }
156 
157 }