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

com.fitbur.tukaani.xz.FinishableWrapperOutputStream Maven / Gradle / Ivy

There is a newer version: 1.0.0
Show newest version
/*
 * FinishableWrapperOutputStream
 *
 * Author: Lasse Collin 
 *
 * This file has been put into the public domain.
 * You can do whatever you want with this file.
 */

package com.fitbur.tukaani.xz;

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

/**
 * Wraps an output stream to a finishable output stream for use with
 * raw encoders. This is not needed for XZ com.fitburpression and thus most
 * people will never need this.
 */
public class FinishableWrapperOutputStream extends FinishableOutputStream {
    /**
     * The {@link java.io.OutputStream OutputStream} that has been
     * wrapped into a FinishableWrapperOutputStream.
     */
    protected OutputStream out;

    /**
     * Creates a new output stream which support finishing.
     * The finish() method will do nothing.
     */
    public FinishableWrapperOutputStream(OutputStream out) {
        this.out = out;
    }

    /**
     * Calls {@link java.io.OutputStream#write(int) out.write(b)}.
     */
    public void write(int b) throws IOException {
        out.write(b);
    }

    /**
     * Calls {@link java.io.OutputStream#write(byte[]) out.write(buf)}.
     */
    public void write(byte[] buf) throws IOException {
        out.write(buf);
    }

    /**
     * Calls {@link java.io.OutputStream#write(byte[],int,int)
                    out.write(buf, off, len)}.
     */
    public void write(byte[] buf, int off, int len) throws IOException {
        out.write(buf, off, len);
    }

    /**
     * Calls {@link java.io.OutputStream#flush() out.flush()}.
     */
    public void flush() throws IOException {
        out.flush();
    }

    /**
     * Calls {@link java.io.OutputStream#close() out.close()}.
     */
    public void close() throws IOException {
        out.close();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy