Methods Summary |
---|
public java.io.StringWriter | append(java.lang.CharSequence csq)Appends the specified character sequence to this writer.
An invocation of this method of the form out.append(csq)
behaves in exactly the same way as the invocation
out.write(csq.toString())
Depending on the specification of toString for the
character sequence csq, the entire sequence may not be
appended. For instance, invoking the toString method of a
character buffer will return a subsequence whose content depends upon
the buffer's position and limit.
if (csq == null)
write("null");
else
write(csq.toString());
return this;
|
public java.io.StringWriter | append(java.lang.CharSequence csq, int start, int end)Appends a subsequence of the specified character sequence to this writer.
An invocation of this method of the form out.append(csq, start,
end) when csq is not null, behaves in
exactly the same way as the invocation
out.write(csq.subSequence(start, end).toString())
CharSequence cs = (csq == null ? "null" : csq);
write(cs.subSequence(start, end).toString());
return this;
|
public java.io.StringWriter | append(char c)Appends the specified character to this writer.
An invocation of this method of the form out.append(c)
behaves in exactly the same way as the invocation
out.write(c)
write(c);
return this;
|
public void | close()Closing a StringWriter has no effect. The methods in this
class can be called after the stream has been closed without generating
an IOException.
|
public void | flush()Flush the stream.
|
public java.lang.StringBuffer | getBuffer()Return the string buffer itself.
return buf;
|
public java.lang.String | toString()Return the buffer's current value as a string.
return buf.toString();
|
public void | write(int c)Write a single character.
buf.append((char) c);
|
public void | write(char[] cbuf, int off, int len)Write a portion of an array of characters.
if ((off < 0) || (off > cbuf.length) || (len < 0) ||
((off + len) > cbuf.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
buf.append(cbuf, off, len);
|
public void | write(java.lang.String str)Write a string.
buf.append(str);
|
public void | write(java.lang.String str, int off, int len)Write a portion of a string.
buf.append(str.substring(off, off + len));
|