This content has been marked as final. Show 7 replies
Please let me know.The question doesn't make sense. Either the flush() and the close() are necessary, in which case you don't have any choice but to execute them, or they aren't, in which case you don't. Performance doesn't come into it.
Part of the answer to this will be found in the Javadoc. Have you read it?
It's like saying "I want to compute 100 factorial. Is it faster if I skip even numbers?" Well, yes, it's quicker, but it gives the wrong answer.
Exactly so. You can get the wrong answer in zero time, if speed is your only objective. No need to write any code at all.
Flush() and Close() , does not matter for difference speed of application which method used. But have good point between those methods : After flush you clean buffer and again can use writer, but after close() you can not use writer, and it is eligible for GC
Wrong. See the Javadoc. It explicitly and directly contradicts you: "Closing a StringWriter has no effect. The methods in this class can be called after the stream has been closed without generating an IOException." Please check your facts before you post.
The part about 'eligible for GC' is, if possible, even more complete nonsense.
You said " but after close() you can not use writer" it is wrong, ok, I agree , "Closing a StringWriter has no effect." . And question that? : after closing can you use StringWriter which closed ?
You said " but after close() you can not use writer" it is wrong, ok, I agreeSo you agree.
"Closing a StringWriter has no effect." And question that? : after closing can you use StringWriter which closed ?So you agree but you're still asking questions about it. I can't make any sense of those questions, if they are questions, but either you agree with the Javadoc, in which case you are right, or you don't, in which case you're wrong.
Or else you didn't, and don't, know how StringWriter.close() behaves, either before or after reading the Javadoc.
Given your mistakes and your subsequent questions it's difficult to see why you posted anything here at all about it in the first place.