Hi there,
I have some data in a StringBuffer which needs written out to a file. Previously I've simply used the toString() method of StringBuffer, i.e.
myWriter.write(myBuffer.toString());
However I encounter problems when the StringBuffer gets really big (around 10 million characters) - an out of memory error is generated when calling the toString() method. Is there a way to write this StringBuffer to a file without first having to create a string? Or perhaps an alternative way instead of using a StringBuffer?
(If not, I could bypass appending to the StringBuffer by writing directly to the writer, however it is better for me to be able to call one function which returns the full data instead of passing writers around)
Cheers
Dan