Example usage for org.apache.commons.io.output TeeOutputStream TeeOutputStream

List of usage examples for org.apache.commons.io.output TeeOutputStream TeeOutputStream

Introduction

In this page you can find the example usage for org.apache.commons.io.output TeeOutputStream TeeOutputStream.

Prototype

public TeeOutputStream(OutputStream out, OutputStream branch) 

Source Link

Document

Constructs a TeeOutputStream.

Usage

From source file:com.example.FirestoreSampleAppTests.java

@BeforeClass
public static void prepare() {
    assumeThat("Firestore-sample tests are disabled. Please use '-Dit.firestore=true' " + "to enable them. ",
            System.getProperty("it.firestore"), is("true"));

    systemOut = System.out;//  w  w  w  . j  a va  2s  .  c  o  m
    baos = new ByteArrayOutputStream();
    TeeOutputStream out = new TeeOutputStream(systemOut, baos);
    System.setOut(new PrintStream(out));
}

From source file:com.example.PollingReceiverTest.java

@BeforeClass
public static void prepare() {
    assumeThat("PUB/SUB-sample integration tests are disabled. Please use '-Dit.pubsub=true' "
            + "to enable them. ", System.getProperty("it.pubsub"), is("true"));

    systemOut = System.out;//from  w  w w.j  a v  a2  s  .c o m
    baos = new ByteArrayOutputStream();
    TeeOutputStream out = new TeeOutputStream(systemOut, baos);
    System.setOut(new PrintStream(out));
}

From source file:com.linkedin.gradle.python.tasks.execution.TeeOutputContainer.java

public TeeOutputContainer(OutputStream stdOut, OutputStream errOut) {
    teeStdOut = new TeeOutputStream(stdOut, mergedStream);
    teeErrOut = new TeeOutputStream(errOut, mergedStream);
}

From source file:com.adobe.acs.commons.httpcache.engine.impl.TeeServletOutputStream.java

public TeeServletOutputStream(OutputStream one, OutputStream two) {
    // Uses Apache IO TeeOutputStream
    teeOutputStream = new TeeOutputStream(one, two);
}

From source file:com.pagecrumb.proxy.wrapper.LoggingResponseWrapper.java

public ServletOutputStream getOutputStream() throws IOException {
    return new DelegatingServletOutputStream(new TeeOutputStream(super.getOutputStream(), outputStream()));
}

From source file:com.discursive.jccook.io.SplitOutExample.java

public void start() {
    File test1 = new File("split1.txt");
    File test2 = new File("split2.txt");
    OutputStream outStream = null;

    try {/*from w w  w  . jav  a2 s.c om*/
        FileOutputStream fos1 = new FileOutputStream(test1);
        FileOutputStream fos2 = new FileOutputStream(test2);
        outStream = new TeeOutputStream(fos1, fos2);

        outStream.write("One Two Three, Test".getBytes());
    } catch (IOException ioe) {
        System.out.println("Error writing to split output stream");
    } finally {
        IOUtils.closeQuietly(outStream);
    }
}

From source file:com.intel.podm.rest.ReplicatedStreamHttpServletResponse.java

@Override
public ServletOutputStream getOutputStream() throws IOException {
    return new ReplicatedServletOutputStream(new TeeOutputStream(super.getOutputStream(), printStream));
}

From source file:appengine_commons.logger_filter.ResponseWrapper.java

@Override
public ServletOutputStream getOutputStream() throws IOException {
    return new ServletOutputStream() {
        private TeeOutputStream tee = new TeeOutputStream(ResponseWrapper.super.getOutputStream(), bos);

        @Override/*from www.j  a v a2s  .  com*/
        public void write(int b) throws IOException {
            tee.write(b);
        }
    };
}

From source file:kziomek.filter.logging.TeeResponseWrapper.java

@Override
public ServletOutputStream getOutputStream() throws IOException {
    return new ServletOutputStream() {
        @Override//from  w ww  .ja  v a2s .  c om
        public boolean isReady() {
            return false;
        }

        @Override
        public void setWriteListener(WriteListener listener) {

        }

        private TeeOutputStream tee = new TeeOutputStream(TeeResponseWrapper.super.getOutputStream(), bos);

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

From source file:com.kotcrab.vis.editor.Log.java

/** Initializes logging facility, called once by VisEditor. */
public static void init() {
    if (initialized)
        throw new IllegalStateException("Log cannot be initialized twice!");
    initialized = true;/*from  w w w .j av a 2s.  c  o  m*/
    prepareLogFile();
    System.setOut(new PrintStream(new TeeOutputStream(System.out, logFileStream)));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, logFileStream)));
}