| WriterWrapper.java |
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.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 }