1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.servlet;
16  
17  import com.liferay.portal.kernel.io.unsync.UnsyncPrintWriter;
18  
19  import java.io.IOException;
20  import java.io.PrintWriter;
21  import java.io.Writer;
22  
23  import javax.servlet.jsp.JspWriter;
24  
25  /**
26   * <a href="PipingJspWriter.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Shuyang Zhou
29   */
30  public class PipingJspWriter extends JspWriter {
31  
32      public PipingJspWriter(PrintWriter printWriter) {
33          super(NO_BUFFER, false);
34  
35          _printWriter = printWriter;
36      }
37  
38      public PipingJspWriter(Writer writer) {
39          super(NO_BUFFER, false);
40  
41          _printWriter = new UnsyncPrintWriter(writer, true);
42      }
43  
44      public void clear() throws IOException {
45          throw new IOException();
46      }
47  
48      public void clearBuffer() {
49      }
50  
51      public void close() {
52          _printWriter.close();
53      }
54  
55      public void flush() {
56          _printWriter.flush();
57      }
58  
59      public int getRemaining() {
60          return 0;
61      }
62  
63      public void newLine() {
64          _printWriter.println();
65      }
66  
67      public void print(boolean b) {
68          _printWriter.print(b);
69      }
70  
71      public void print(char c) {
72          _printWriter.print(c);
73      }
74  
75      public void print(char[] charArray) {
76          _printWriter.print(charArray);
77      }
78  
79      public void print(double d) {
80          _printWriter.print(d);
81      }
82  
83      public void print(float f) {
84          _printWriter.print(f);
85      }
86  
87      public void print(int i) {
88          _printWriter.print(i);
89      }
90  
91      public void print(long l) {
92          _printWriter.print(l);
93      }
94  
95      public void print(Object object) {
96          _printWriter.print(object);
97      }
98  
99      public void print(String string) {
100         _printWriter.print(string);
101     }
102 
103     public void println() {
104         _printWriter.println();
105     }
106 
107     public void println(boolean b) {
108         _printWriter.println(b);
109     }
110 
111     public void println(char c) {
112         _printWriter.println(c);
113     }
114 
115     public void println(char[] charArray) {
116         _printWriter.println(charArray);
117     }
118 
119     public void println(double d) {
120         _printWriter.println(d);
121     }
122 
123     public void println(float f) {
124         _printWriter.println(f);
125     }
126 
127     public void println(int i) {
128         _printWriter.println(i);
129     }
130 
131     public void println(long l) {
132         _printWriter.println(l);
133     }
134 
135     public void println(Object object) {
136         _printWriter.println(object);
137     }
138 
139     public void println(String string) {
140         _printWriter.println(string);
141     }
142 
143     public void write(char[] charArray) {
144         _printWriter.write(charArray);
145     }
146 
147     public void write(char[] charArray, int offset, int length) {
148         _printWriter.write(charArray, offset, length);
149     }
150 
151     public void write(int c) {
152         _printWriter.write(c);
153     }
154 
155     public void write(String string) {
156         _printWriter.write(string);
157     }
158 
159     public void write(String string, int offset, int length) {
160         _printWriter.write(string, offset, length);
161     }
162 
163     private PrintWriter _printWriter;
164 
165 }