All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.vpro.web.support.WrappedServletOutputStream Maven / Gradle / Ivy

/*
 * Copyright (C) 2010 All rights reserved
 * VPRO The Netherlands
 */
package nl.vpro.web.support;

import java.io.DataOutputStream;
import java.io.IOException;
import java.io.OutputStream;

import javax.servlet.ServletOutputStream;

import org.checkerframework.checker.nullness.qual.NonNull;

/**
 * To wrap the output stream we need an implementation of a ServletOutputStream
 */
public class WrappedServletOutputStream extends ServletOutputStream {

    private DataOutputStream stream;

    public WrappedServletOutputStream(OutputStream stream) {
        this.stream = new DataOutputStream(stream);
    }

    @Override
    public void write(int b) throws IOException {
        stream.write(b);
    }

    @Override
    public void write(@NonNull byte[] b) throws IOException {
        stream.write(b);
    }

    @Override
    public void write(@NonNull byte[] b, int off, int len) throws IOException {
        stream.write(b, off, len);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy