public final class AppendableWriter extends java.io.Writer implements Reusable
This class allows any Appendable to be used as
a writer.
| Constructor and Description |
|---|
AppendableWriter()
Creates a new appendable writer for which the appendable output
is not set.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes and
resets this writer for reuse. |
void |
flush()
Flushes the stream.
|
void |
reset()
Resets the internal state of this object to its default values.
|
AppendableWriter |
setOutput(java.lang.Appendable output)
Sets the appendable output being written to.
|
void |
write(char c)
Writes a single character.
|
void |
write(char[] cbuf,
int off,
int len)
Writes a portion of an array of characters.
|
void |
write(java.lang.CharSequence csq)
Writes the specified character sequence.
|
void |
write(int c)
Writes the 16 low-order bits of the given integer value;
the 16 high-order bits are ignored.
|
void |
write(java.lang.String str,
int off,
int len)
Writes a portion of a string.
|
public AppendableWriter()
setOutput(Appendable)public AppendableWriter setOutput(java.lang.Appendable output)
Writer writer = new AppendableWriter().setOutput(new TextBuilder());
public void write(char c)
throws java.io.IOException
c - char the character to be written.java.io.IOException - if an I/O error occurs.public void write(int c)
throws java.io.IOException
write in class java.io.Writerc - the value of the character to be written.java.io.IOException - if an I/O error occurs.public void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
write in class java.io.Writercbuf - the array of characters.off - the offset from which to start writing characters.len - the number of characters to write.java.io.IOException - if an I/O error occurs.public void write(java.lang.String str,
int off,
int len)
throws java.io.IOException
write in class java.io.Writerstr - a String.off - the offset from which to start writing characters.len - the number of characters to write.java.io.IOException - if an I/O error occurspublic void write(java.lang.CharSequence csq)
throws java.io.IOException
csq - the character sequence.java.io.IOException - if an I/O error occurspublic void flush()
flush in interface java.io.Flushableflush in class java.io.Writerpublic void close()
resets this writer for reuse.close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.WriterCopyright © 2005 - 2007 Javolution.