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
2
* Licensed to the Apache Software Foundation (ASF) under one or more
3
* contributor license agreements. See the NOTICE file distributed with
4
* this work for additional information regarding copyright ownership.
5
* The ASF licenses this file to You under the Apache License, Version 2.0
6
* (the "License"); you may not use this file except in compliance with
7
* the License. You may obtain a copy of the License at
8
9
* http://www.apache.org/licenses/LICENSE-2.0
20
21
import java.io.OutputStream;
24
24
* A Proxy stream which acts as expected, that is it passes the method
25
25
* calls on to the proxied stream and doesn't change which methods are
26
26
* being called. It is an alternative base class to FilterOutputStream
27
27
* to increase reusability.
29
* @author Stephen Colebourne
30
* @version $Id: ProxyOutputStream.java 471628 2006-11-06 04:06:45Z bayard $
29
32
public class ProxyOutputStream extends FilterOutputStream {
31
private OutputStream proxy;
34
35
* Constructs a new ProxyOutputStream.
35
* @param proxy OutputStream to delegate to
37
* @param proxy the OutputStream to delegate to
37
39
public ProxyOutputStream(OutputStream proxy) {
41
// the proxy is stored in a protected superclass variable named 'out'
42
44
/** @see java.io.OutputStream#write(int) */
43
45
public void write(int idx) throws IOException {
44
this.proxy.write(idx);
47
49
/** @see java.io.OutputStream#write(byte[]) */
48
50
public void write(byte[] bts) throws IOException {
49
this.proxy.write(bts);
52
54
/** @see java.io.OutputStream#write(byte[], int, int) */
53
55
public void write(byte[] bts, int st, int end) throws IOException {
54
this.proxy.write(bts, st, end);
56
out.write(bts, st, end);
57
59
/** @see java.io.OutputStream#flush() */
58
60
public void flush() throws IOException {
62
64
/** @see java.io.OutputStream#close() */
63
65
public void close() throws IOException {