java.io.Closeable
, java.io.Flushable
, java.lang.AutoCloseable
public class TeeOutputStream extends ProxyOutputStream
Modifier and Type | Field | Description |
---|---|---|
protected java.io.OutputStream |
branch |
the second OutputStream to write to
|
Constructor | Description |
---|---|
TeeOutputStream(java.io.OutputStream out,
java.io.OutputStream branch) |
Constructs a TeeOutputStream.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
Closes both output streams.
|
void |
flush() |
Flushes both streams.
|
void |
write(byte[] b) |
Write the bytes to both streams.
|
void |
write(byte[] b,
int off,
int len) |
Write the specified bytes to both streams.
|
void |
write(int b) |
Write a byte to both streams.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
afterWrite, beforeWrite, handleIOException
public TeeOutputStream(java.io.OutputStream out, java.io.OutputStream branch)
out
- the main OutputStreambranch
- the second OutputStreampublic void write(byte[] b) throws java.io.IOException
write
in class ProxyOutputStream
b
- the bytes to writejava.io.IOException
- if an I/O error occurspublic void write(byte[] b, int off, int len) throws java.io.IOException
write
in class ProxyOutputStream
b
- the bytes to writeoff
- The start offsetlen
- The number of bytes to writejava.io.IOException
- if an I/O error occurspublic void write(int b) throws java.io.IOException
write
in class ProxyOutputStream
b
- the byte to writejava.io.IOException
- if an I/O error occurspublic void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class ProxyOutputStream
java.io.IOException
- if an I/O error occurspublic void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
close
in class ProxyOutputStream
java.io.IOException
- if an I/O error occursCopyright (c) 2002-2017 Apache Software Foundation