1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.util.bridges.jsf.sun;
16  
17  import java.io.IOException;
18  import java.io.Writer;
19  
20  /**
21   * <a href="WriterWrapper.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Brian Myunghun Kim
24   */
25  public class WriterWrapper extends Writer {
26  
27      public WriterWrapper(Writer writer) {
28          _writer = writer;
29      }
30  
31      public void close() throws IOException {
32          _writer.close();
33      }
34  
35      public void flush() {
36      }
37  
38      public void write(char cbuf) throws IOException {
39          _writer.write(cbuf);
40      }
41  
42      public void write(char[] cbuf, int off, int len) throws IOException {
43          StringBuilder sb = new StringBuilder(len);
44  
45          sb.append(cbuf, off, len);
46  
47          _writer.write(sb.toString());
48      }
49  
50      public void write(int c) throws IOException {
51          _writer.write(c);
52      }
53  
54      public void write(String str) throws IOException {
55          _writer.write(str);
56      }
57  
58      public void write(String str, int off, int len) throws IOException {
59          _writer.write(str, off, len);
60      }
61  
62      private Writer _writer;
63  
64  }