public class StringWriter extends Writer
Constructor and Description |
---|
StringWriter() |
StringWriter(int initialSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the stream, flushing it first.
|
void |
flush()
Flush the stream.
|
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters.
|
void |
write(String str)
Write a string.
|
void |
write(String str,
int off,
int len)
Write a portion of a string.
|
public StringWriter()
public StringWriter(int initialSize)
public void write(char[] cbuf, int off, int len) throws IOException
Writer
write
in class Writer
cbuf
- Array of charactersoff
- Offset from which to start writing characterslen
- Number of characters to writeIOException
- If an I/O error occurspublic void write(String str) throws IOException
Writer
write
in class Writer
str
- String to be writtenIOException
- If an I/O error occurspublic void write(String str, int off, int len) throws IOException
Writer
write
in class Writer
str
- A Stringoff
- Offset from which to start writing characterslen
- Number of characters to writeIOException
- If an I/O error occurspublic void flush() throws IOException
Writer
flush
in class Writer
IOException
- If an I/O error occurspublic void close() throws IOException
Writer
close
in class Writer
IOException
- If an I/O error occurs