View Javadoc

1   /*
2    * $Id: StrutsMockBodyContent.java 439747 2006-09-03 09:22:46Z mrdon $
3    *
4    * Copyright 2006 The Apache Software Foundation.
5    *
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.struts2.views.jsp;
19  
20  import java.io.IOException;
21  import java.io.Reader;
22  import java.io.Writer;
23  
24  import javax.servlet.jsp.JspWriter;
25  import javax.servlet.jsp.tagext.BodyContent;
26  
27  
28  /***
29   * StrutsMockBodyContent
30   *
31   */
32  public class StrutsMockBodyContent extends BodyContent {
33  
34      private JspWriter jspWriter;
35      private String body = null;
36  
37  
38      public StrutsMockBodyContent(JspWriter jspWriter) {
39          super(jspWriter);
40          this.jspWriter = jspWriter;
41      }
42  
43  
44      public Reader getReader() {
45          return null;
46      }
47  
48      public int getRemaining() {
49          return jspWriter.getRemaining();
50      }
51  
52      public void setString(String body) {
53          this.body = body;
54      }
55  
56      public String getString() {
57          return body;
58      }
59  
60      public void clear() throws IOException {
61          jspWriter.clear();
62      }
63  
64      public void clearBuffer() throws IOException {
65          jspWriter.clearBuffer();
66      }
67  
68      public void close() throws IOException {
69          jspWriter.close();
70      }
71  
72      public void newLine() throws IOException {
73          jspWriter.newLine();
74      }
75  
76      public void print(double v) throws IOException {
77          jspWriter.print(v);
78      }
79  
80      public void print(int i) throws IOException {
81          jspWriter.print(i);
82      }
83  
84      public void print(long l) throws IOException {
85          jspWriter.print(l);
86      }
87  
88      public void print(float v) throws IOException {
89          jspWriter.print(v);
90      }
91  
92      public void print(boolean b) throws IOException {
93          jspWriter.print(b);
94      }
95  
96      public void print(String s) throws IOException {
97          jspWriter.print(s);
98      }
99  
100     public void print(char c) throws IOException {
101         jspWriter.print(c);
102     }
103 
104     public void print(Object o) throws IOException {
105         jspWriter.print(o);
106     }
107 
108     public void print(char[] chars) throws IOException {
109         jspWriter.print(chars);
110     }
111 
112     public void println() throws IOException {
113         jspWriter.println();
114     }
115 
116     public void println(char c) throws IOException {
117         jspWriter.println(c);
118     }
119 
120     public void println(String s) throws IOException {
121         jspWriter.println(s);
122     }
123 
124     public void println(char[] chars) throws IOException {
125         jspWriter.println(chars);
126     }
127 
128     public void println(boolean b) throws IOException {
129         jspWriter.println(b);
130     }
131 
132     public void println(long l) throws IOException {
133         jspWriter.println(l);
134     }
135 
136     public void println(int i) throws IOException {
137         jspWriter.println(i);
138     }
139 
140     public void println(float v) throws IOException {
141         jspWriter.println(v);
142     }
143 
144     public void println(double v) throws IOException {
145         jspWriter.println(v);
146     }
147 
148     public void println(Object o) throws IOException {
149         jspWriter.println(o);
150     }
151 
152     public void write(char[] chars, int i, int i1) throws IOException {
153         jspWriter.write(chars, i, i1);
154     }
155 
156     public void writeOut(Writer writer) throws IOException {
157         writer.write(body);
158     }
159 }