Hi have a situation where performance is a major issue
I am using jakarta POI package for reading WordDocument and writing the parsed text into output buffer. By Default jakarta is providing writeAllText(java.io.Writer) as the method to write the parsed text into the output buffer.
But my client needs the method something like getDocumentText() that should written String. This return String will be used for some other purposes. SO I have used StringWriter as an Object to writeAllText() Method and using StringWriter().getBuffer().toString() I am returning the parsed text as a String Object.
But this is becoming problem. Writing parsed text to Writer and then returning it into String slows down the proccess.
So what I did is I have written Some Other method in Jakata class that returns String. But Intenally uses StringBuffer
( I don't know whether it is legal or not to write my own method in Jakarta Package - If any body knows please let me know regarding this )
OK coming to my technical problem, even this is also not a quite good Idea, becase StringBuffer.toString() reduces the proformance.
And also you know that using of String for internal proccesses is not a quite good idea.(As it is Immutable). hence I have used StringBuffer for internal proccess.
So what is the best proccess I have to follow to make my return method works with high performance?
P.S : The return method should return String only.