package com.atlassian.stash.internal.web.util.web;

import javax.servlet.ServletOutputStream;
import java.io.IOException;

/**
 * We can't extend {@link java.io.FilterOutputStream} because we need to be a {@link ServletOutputStream}.
 *
 * @since 4.0
 */
public class FilterServletOutputStream extends ServletOutputStream {

    protected final ServletOutputStream out;

    protected FilterServletOutputStream(ServletOutputStream out) {
        this.out = out;
    }

    @Override
    public void write(int 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();
    }
}