/*******************************************************************************
*
* Copyright (c) 2004-2009 Oracle Corporation.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
*
* Kohsuke Kawaguchi
*
*
*******************************************************************************/
package hudson.util;
import java.io.FilterOutputStream;
import java.io.OutputStream;
import java.io.IOException;
/**
* Works like {@link FilterOutputStream} except its performance problem.
*
* @author Kohsuke Kawaguchi
*/
public abstract class DelegatingOutputStream extends OutputStream {
protected OutputStream out;
protected DelegatingOutputStream(OutputStream out) {
if (out == null) {
throw new IllegalArgumentException("null stream");
}
this.out = out;
}
public void write(int b) throws IOException {
out.write(b);
}
@Override
public void write(byte[] b) throws IOException {
out.write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
out.write(b, off, len);
}
@Override
public void flush() throws IOException {
out.flush();
}
@Override
public void close() throws IOException {
out.close();
}
}