public class TeeOutputStream extends ProxyOutputStream
OutputStream
. Named after the Unix 'tee' command. It allows a stream to be branched off
so there are now two streams.Constructor and Description |
---|
TeeOutputStream(java.io.OutputStream out,
java.io.OutputStream branch)
Constructs a TeeOutputStream.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes both output streams.
|
void |
flush()
Flushes both streams.
|
void |
write(byte[] b)
Writes the bytes to both streams.
|
void |
write(byte[] b,
int off,
int len)
Writes the specified bytes to both streams.
|
void |
write(int b)
Writes a byte to both streams.
|
public TeeOutputStream(java.io.OutputStream out, java.io.OutputStream branch)
out
- the main OutputStreambranch
- the second OutputStreampublic void close() throws java.io.IOException
If closing the main output stream throws an exception, attempt to close the branch output stream.
If closing the main and branch output streams both throw exceptions, which exceptions is thrown by this method is currently unspecified and subject to change.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class ProxyOutputStream
java.io.IOException
- if an I/O error occurs.public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class ProxyOutputStream
java.io.IOException
- if an I/O error occurs.public void write(byte[] b) throws java.io.IOException
write
in class ProxyOutputStream
b
- the bytes to writejava.io.IOException
- if an I/O error occurs.public 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 occurs.public void write(int b) throws java.io.IOException
write
in class ProxyOutputStream
b
- the byte to writejava.io.IOException
- if an I/O error occurs.Copyright © 2010 - 2023 Adobe. All Rights Reserved