public class DelegatingWriter
extends java.io.Writer
| 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 StreamType |
type
Stores the type of stream to delegate to.
|
private java.io.Writer |
writer
Stores the writer to delegate to.
|
| Constructor and Description |
|---|
DelegatingWriter(java.io.Writer writer,
StreamType type)
Creates a delegating writer.
|
DelegatingWriter(java.io.Writer writer,
StreamType type,
java.lang.String recId)
Creates a delegating writer.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.Writer |
append(char ch)
Appends the specified character to this writer.
|
java.io.Writer |
append(java.lang.CharSequence csq)
Appends the specified character sequence to this writer.
|
java.io.Writer |
append(java.lang.CharSequence csq,
int start,
int end)
Appends a subsequence of the specified character sequence to this writer.
|
void |
close()
Closes the stream.
|
void |
flush()
Flushes the contents.
|
void |
write(char[] buffer)
Writes a data array.
|
void |
write(char[] buffer,
int off,
int len)
Writes a portion of a data array.
|
void |
write(int value)
Writes a char to the writer.
|
private java.io.Writer writer
private boolean inWrite3
private boolean inWrite1
private StreamType type
private java.lang.String recId
public DelegatingWriter(java.io.Writer writer,
StreamType type)
writer - the writer to delegate to.type - the type of streampublic DelegatingWriter(java.io.Writer writer,
StreamType type,
java.lang.String recId)
writer - the writer to delegate to.type - the type of streamrecId - the recorder id to aggregate the notifications forpublic void write(int value)
throws java.io.IOException
write in class java.io.Writervalue - the charjava.io.IOException - If an I/O error occurspublic void write(char[] buffer)
throws java.io.IOException
write in class java.io.Writerbuffer - the data arrayjava.io.IOException - If an I/O error occurspublic void write(char[] buffer,
int off,
int len)
throws java.io.IOException
write in class java.io.Writerbuffer - 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.Writerjava.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.Writerjava.io.IOException - in case of I/O errorspublic java.io.Writer append(char ch)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writerch - The 16-bit character to appendjava.io.IOException - If an I/O error occurspublic java.io.Writer append(java.lang.CharSequence csq)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writercsq - The character sequence to append. If csq is
null, then the four characters "null" are
appended to this writer.java.io.IOException - If an I/O error occurspublic java.io.Writer append(java.lang.CharSequence csq,
int start,
int end)
throws java.io.IOException
append in interface java.lang.Appendableappend in class java.io.Writercsq - The character sequence from which a subsequence will be
appended. If csq is null, then characters
will be appended as if csq contained the four
characters "null".start - The index of the first character in the subsequenceend - The index of the character following the last character in the
subsequencejava.lang.IndexOutOfBoundsException - If start or end are negative, start
is greater than end, or end is greater than
csq.length()java.io.IOException - If an I/O error occurs