Closing a StringWriter
has no effect. The methods in this class
can be called after the stream has been closed without generating an
IOException
.
Modifier and Type | Field and Description |
---|---|
private final StringBuffer |
Access | Constructor and Description |
---|---|
public | |
public | StringWriter(int
The number of initialSize)char values that will fit into this buffer
before it is automatically expandedCreate a new string writer using the specified initial string-buffer size. |
Modifier and Type | Method and Description |
---|---|
public StringWriter | Returns: This writerThe character sequence to append. If csq)csq is
null , then the four characters "null" are
appended to this writer.Overrides java. Implements java. Appends the specified character sequence to this writer. |
public StringWriter | Returns: This writerThe character sequence from which a subsequence will be
appended. If csq, int csq is null , then characters
will be appended as if csq contained the four
characters "null" .The index of the first character in the subsequence start, int The index of the character following the last character in the
subsequence end)Overrides java. Implements java. Appends a subsequence of the specified character sequence to this writer. |
public StringWriter | Returns: This writerThe 16-bit character to append c)Overrides java. Implements java. Appends the specified character to this writer. |
public void | close()
Implements abstract java. Implements java. Closing a |
public void | flush()
Implements abstract java. Implements java. Flush the stream. |
public StringBuffer | |
public String | |
public void | write(int
int specifying a character to be written c)Overrides java. Write a single character. |
public void | write(char[]
Array of characters cbuf, int Offset from which to start writing characters off, int Number of characters to write len)Implements abstract java. Write a portion of an array of characters. |
public void | |
public void | write(String
String to be written str, int Offset from which to start writing characters off, int Number of characters to write len)Overrides java. Write a portion of a string. |
buf | back to summary |
---|---|
private final StringBuffer buf |
StringWriter | back to summary |
---|---|
public StringWriter() Create a new string writer using the default initial string-buffer size. |
StringWriter | back to summary |
---|---|
public StringWriter(int initialSize) Create a new string writer using the specified initial string-buffer size.
|
append | back to summary |
---|---|
public StringWriter append(CharSequence csq) Overrides java. Implements java. Appends the specified character sequence to this writer. An invocation of this method of the form out.write(csq.toString()) Depending on the specification of
|
append | back to summary |
---|---|
public StringWriter append(CharSequence csq, int start, int end) Overrides java. Implements java. Appends a subsequence of the specified character sequence to this writer. An invocation of this method of the form
out.write(csq.subSequence(start, end).toString())
|
append | back to summary |
---|---|
public StringWriter append(char c) Overrides java. Implements java. Appends the specified character to this writer. An invocation of this method of the form out.write(c)
|
close | back to summary |
---|---|
public void close() throws IOException Implements abstract java. Implements java. Closing a
|
flush | back to summary |
---|---|
public void flush() Implements abstract java. Implements java. Flush the stream. The |
getBuffer | back to summary |
---|---|
public StringBuffer getBuffer() Return the string buffer itself.
|
toString | back to summary |
---|---|
public String toString() Overrides java. Return the buffer's current value as a string.
|
write | back to summary |
---|---|
public void write(int c) Overrides java. Write a single character.
|
write | back to summary |
---|---|
public void write(char[] cbuf, int off, int len) Implements abstract java. Write a portion of an array of characters.
|
write | back to summary |
---|---|
public void write(String str) Overrides java. Write a string.
|
write | back to summary |
---|---|
public void write(String str, int off, int len) Overrides java. Write a portion of a string.
|