Example usage for org.bouncycastle.util.io TeeOutputStream TeeOutputStream

List of usage examples for org.bouncycastle.util.io TeeOutputStream TeeOutputStream

Introduction

In this page you can find the example usage for org.bouncycastle.util.io TeeOutputStream TeeOutputStream.

Prototype

public TeeOutputStream(OutputStream output1, OutputStream output2) 

Source Link

Document

Base constructor.

Usage

From source file:net.staticsnow.nexus.repository.apt.internal.hosted.CompressingTempFileStore.java

License:Open Source License

public Writer openOutput(String key) throws UncheckedIOException {
    try {/*from   w  ww. j  a  v a 2  s .  c o m*/
        if (holdersByKey.containsKey(key)) {
            throw new IllegalStateException("Output already opened");
        }
        FileHolder holder = new FileHolder();
        holdersByKey.put(key, holder);
        return new OutputStreamWriter(new TeeOutputStream(
                new TeeOutputStream(new GZIPOutputStream(Files.newOutputStream(holder.gzTempFile)),
                        new BZip2CompressorOutputStream(Files.newOutputStream(holder.bzTempFile))),
                Files.newOutputStream(holder.plainTempFile)), Charsets.UTF_8);
    } catch (IOException e) {
        throw new UncheckedIOException(e);
    }
}