public class StringBufferWriter
extends java.io.Writer
| Constructor and Description |
|---|
StringBufferWriter(java.lang.StringBuffer buffer) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close the stream, flushing it first.
|
void |
flush()
Flush the stream.
|
java.lang.StringBuffer |
getBuffer() |
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(int c)
Write a single character.
|
void |
write(java.lang.String str)
Write a string.
|
public java.lang.StringBuffer getBuffer()
public void write(int c)
throws java.io.IOException
Subclasses that intend to support efficient single-character output should override this method.
write in class java.io.Writerc - int specifying a character to be written.java.io.IOException - If an I/O error occurspublic void write(java.lang.String str)
throws java.io.IOException
write in class java.io.Writerstr - String to be writtenjava.io.IOException - If an I/O error occurspublic void write(char[] cbuf,
int off,
int len)
throws java.io.IOException
write in class java.io.Writercbuf - Array of charactersoff - 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 - If an I/O error occurspublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Writerjava.io.IOException - If an I/O error occurs