public class DelegatingOutputStream
extends java.io.OutputStream
| Modifier and Type | Field and Description |
|---|---|
private boolean |
inWrite1
Stores if we are in a write method with 1 parameter (avoid double
recording).
|
private boolean |
inWrite3
Stores if we are in a write method with 3 parameters (avoid double
recording).
|
private java.lang.String |
recId
Stores the recorder id to aggregate the notifications for.
|
private java.io.OutputStream |
stream
Stores the output stream to delegate to.
|
private StreamType |
type
Stores the type of stream to delegate to.
|
| Constructor and Description |
|---|
DelegatingOutputStream(java.io.OutputStream stream,
StreamType type)
Creates a new delegating stream.
|
DelegatingOutputStream(java.io.OutputStream stream,
StreamType type,
java.lang.String recId)
Creates a new delegating stream.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the contents.
|
void |
write(byte[] buffer)
Writes a data array.
|
void |
write(byte[] buffer,
int off,
int len)
Writes a portion of a data array.
|
void |
write(int value)
Writes a byte to the stream.
|
private java.io.OutputStream stream
private boolean inWrite3
private boolean inWrite1
private StreamType type
private java.lang.String recId
public DelegatingOutputStream(java.io.OutputStream stream,
StreamType type)
stream - the stream to delegate the operations totype - the type of the streampublic DelegatingOutputStream(java.io.OutputStream stream,
StreamType type,
java.lang.String recId)
stream - the stream to delegate the operations totype - the type of the streamrecId - the recorder id to aggregate the notifications forpublic void write(int value)
throws java.io.IOException
write in class java.io.OutputStreamvalue - the data bytejava.io.IOException - If an I/O error occurspublic void write(byte[] buffer)
throws java.io.IOException
write in class java.io.OutputStreambuffer - the data arrayjava.io.IOException - If an I/O error occurspublic void write(byte[] buffer,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreambuffer - the data arrayoff - Offset from which to start writing characterslen - Number of characters to writejava.io.IOException - If an I/O error occurspublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOException - in case of I/O errorspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOException - in case of I/O errors