Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

StringWriter not clear the buffered content

 
Pene charl
Greenhorn
Posts: 21
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 21
Hibernate Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you william...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic