2
* Copyright 2002-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
16
package org.apache.commons.io.output;
18
import java.io.IOException;
19
import java.io.FilterWriter;
20
import java.io.Writer;
24
* A Proxy stream which acts as expected, that is it passes the method
25
* calls on to the proxied stream and doesn't change which methods are
26
* being called. It is an alternative base class to FilterWriter
27
* to increase reusability, because FilterWriter changes the
28
* methods being called, such as write(char[]) to write(char[], int, int)
29
* and write(String) to write(String, int, int).
31
public class ProxyWriter extends FilterWriter {
36
* Constructs a new ProxyWriter.
37
* @param proxy Writer to delegate to
39
public ProxyWriter(Writer proxy) {
44
/** @see java.io.Writer#write(int) */
45
public void write(int idx) throws IOException {
46
this.proxy.write(idx);
49
/** @see java.io.Writer#write(char[]) */
50
public void write(char[] chr) throws IOException {
51
this.proxy.write(chr);
54
/** @see java.io.Writer#write(char[], int, int) */
55
public void write(char[] chr, int st, int end) throws IOException {
56
this.proxy.write(chr, st, end);
59
/** @see java.io.Writer#write(String) */
60
public void write(String str) throws IOException {
61
this.proxy.write(str);
64
/** @see java.io.Writer#write(String, int, int) */
65
public void write(String str, int st, int end) throws IOException {
66
this.proxy.write(str, st, end);
69
/** @see java.io.Writer#flush() */
70
public void flush() throws IOException {
74
/** @see java.io.Writer#close() */
75
public void close() throws IOException {