aspose file tools*
The moose likes Performance and the fly likes StringWriter not clear the buffered content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "StringWriter not clear the buffered content" Watch "StringWriter not clear the buffered content" New topic
Author

StringWriter not clear the buffered content

Pene charl
Greenhorn

Joined: Jun 14, 2011
Posts: 21

Hi friends,
I have the for loop to generate xml document tree and that has to be stored as string in java.
For storing i have to use stringWriter.
After the single circulation of loop,i need to clear the stringwriter and store new xml string for second circulation..
I had tried with flush() and also getbuffer.setLength(0).
But not succeed .
Please help.


Regards:Prince Charles
http://www.princecharl.blogspot.com
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12789
    
    5
A StringWriter object can not be reused or cleared, if you want an empty StringWriter, create a new one.

The flush and close methods are just there to be compatible with java.io.Writer.

Bill
Pene charl
Greenhorn

Joined: Jun 14, 2011
Posts: 21

Thank you william...
 
 
subject: StringWriter not clear the buffered content