Methods Summary |
---|
public void | close()Close this Writer. This is the concrete implementation required. This
particular implementation does nothing.
|
public void | flush()Flush this Writer. This is the concrete implementation required. This
particular implementation does nothing.
|
public java.lang.StringBuffer | getBuffer()Answer the contents of this StringWriter as a StringBuffer. Any changes
made to the StringBuffer by the receiver or the caller are reflected in
this StringWriter.
synchronized (lock) {
return buf;
}
|
public java.lang.String | toString()Answer the contents of this StringWriter as a String. Any changes made to
the StringBuffer by the receiver after returning will not be reflected in
the String returned to the caller.
synchronized (lock) {
return buf.toString();
}
|
public void | write(java.lang.String str, int offset, int count)Writes count number of characters starting at
offset from the String str to this
StringWriter.
String sub = str.substring(offset, offset + count);
synchronized (lock) {
buf.append(sub);
}
|
public void | write(char[] buf, int offset, int count)Writes count characters starting at offset
in buf to this StringWriter.
// avoid int overflow
if (0 <= offset && offset <= buf.length && 0 <= count
&& count <= buf.length - offset) {
synchronized (lock) {
this.buf.append(buf, offset, count);
}
} else {
throw new ArrayIndexOutOfBoundsException();
}
|
public void | write(int oneChar)Writes the specified character oneChar to this
StringWriter. This implementation writes the low order two bytes to the
Stream.
synchronized (lock) {
buf.append((char) oneChar);
}
|
public void | write(java.lang.String str)Writes the characters from the String str to this
StringWriter.
synchronized (lock) {
buf.append(str);
}
|