Example usage for org.apache.commons.io.output NullOutputStream nullOutputStream

List of usage examples for org.apache.commons.io.output NullOutputStream nullOutputStream

Introduction

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

Prototype

public static OutputStream nullOutputStream() 

Source Link

Document

Returns a new OutputStream which discards all bytes.

Usage

From source file:ch.cyberduck.core.io.DefaultStreamCloserTest.java

@Test(expected = InteroperabilityException.class)
public void testClose() throws Exception {
    new DefaultStreamCloser().close(new HttpResponseOutputStream<Void>(new NullOutputStream()) {
        @Override//from   ww  w .  ja  v a2  s .  co m
        public Void getStatus() throws BackgroundException {
            throw new InteroperabilityException("d");
        }
    });
}

From source file:ch.cyberduck.core.http.ResponseOutputStreamTest.java

@Test(expected = IOException.class)
public void testClose() throws Exception {
    try {/*from   w  w  w  . ja  va 2s . c o m*/
        new ResponseOutputStream<Void>(new NullOutputStream()) {
            @Override
            public Void getResponse() throws BackgroundException {
                throw new InteroperabilityException("d");
            }
        }.close();
    } catch (IOException e) {
        assertEquals("d. Please contact your web hosting service provider for assistance.", e.getMessage());
        throw e;
    }
}

From source file:ch.cyberduck.core.http.HttpResponseOutputStreamTest.java

@Test(expected = IOException.class)
public void testClose() throws Exception {
    try {/*  w  ww.j a  v  a2 s .c o  m*/
        new HttpResponseOutputStream<Void>(new NullOutputStream()) {
            @Override
            public Void getStatus() throws BackgroundException {
                throw new InteroperabilityException("d");
            }
        }.close();
    } catch (IOException e) {
        assertEquals("d. Please contact your web hosting service provider for assistance.", e.getMessage());
        throw e;
    }
}

From source file:fi.jumi.core.stdout.SystemOutErrTest.java

@Test
public void sets_the_real_stdout() {
    PrintStream newStream = new PrintStream(new NullOutputStream());

    systemOutErr.setOut(newStream);/*w  ww.  j a v a  2 s.  co  m*/

    assertThat(System.out, is(newStream));
}

From source file:ch.cyberduck.core.io.BufferOutputStream.java

public BufferOutputStream(final Buffer buffer) {
    this(new NullOutputStream(), buffer, 0L);
}

From source file:ch.cyberduck.core.io.BufferSegmentingOutputStream.java

public BufferSegmentingOutputStream(final OutputStream proxy, final Long threshold, final Buffer buffer) {
    super(new NullOutputStream(), threshold, new BufferOutputStream(buffer));
    this.proxy = proxy;
    this.buffer = buffer;
}

From source file:ch.cyberduck.core.io.BufferOutputStream.java

public BufferOutputStream(final Buffer buffer, final Long offset) {
    this(new NullOutputStream(), buffer, offset);
}

From source file:fi.jumi.core.stdout.SystemOutErrTest.java

@Test
public void sets_the_real_stderr() {
    PrintStream newStream = new PrintStream(new NullOutputStream());

    systemOutErr.setErr(newStream);/*from  w  w w  . ja  v  a  2  s. c  o m*/

    assertThat(System.err, is(newStream));
}

From source file:javancss.ParseDebugTest.java

@Override
protected Javancss measureTestFile(int testFileId) {
    Logger logger = Logger.getLogger("javancss");
    logger.setLevel(Level.FINEST);

    PrintStream stdout = System.out;
    PrintStream stderr = System.err;

    try {//from  w  ww .j  a v  a2  s  .co  m
        System.setOut(new PrintStream(new NullOutputStream()));
        System.setErr(new PrintStream(new NullOutputStream()));

        return super.measureTestFile(testFileId);
    } finally {
        logger.setLevel(Level.OFF);
        System.setOut(stdout);
        System.setErr(stderr);
    }
}

From source file:ch.cyberduck.core.NullWriteFeature.java

@Override
public StatusOutputStream<Void> write(final Path file, final TransferStatus status,
        final ConnectionCallback callback) throws BackgroundException {
    return new VoidStatusOutputStream(new NullOutputStream());
}