Java Reference
In-Depth Information
public
CharArrayWriter()
Creates a new
CharArrayWriter
with a default initial array size.
public
CharArrayWriter(int size)
Creates a new
CharArrayWriter
with the given initial array size.
public int
size()
Returns the number of characters generated thus far by out-
put to the stream.
public char[]
toCharArray()
Returns a copy of the characters generated thus far by output
to the stream. When you are finished writing into a
CharAr-
rayWriter
via upstream filter streams, you should flush the up-
stream objects before using
toCharArray
.
public void
reset()
Resets the stream to reuse the current buffer, discarding its
contents.
public String
toString()
Returns the current contents of the buffer as a
String
.
public void
writeTo(Writer out)
tHRows IOException
Writes the current contents of the buffer to the stream
out
.