com.wm.app.tn.err.EXMLException

Hello All,
I am working on wM 6.0.1(Developer&TN).I am retrieving data from aTNDocument (which has been Large Document handled) in my custom code in developer .
This flow of custom code is as below
1.wm.tnweb.querySvc:getDocuments 2.wm.tnweb.querySvc:getContentPartBytes
3.wm.tn.doc:getContentPartData(get as stream)

This stream first I convert to bytes, then bytes to string and I use this string .

But the service throws the below error at runtime:
error
TRNSERV.000018.000066 Error encountered in invoking service wm.tnweb.querySvc:getDocDetails java.lang.OutOfMemoryError java.lang.OutOfMemoryError 0
errorType
com.wm.app.tn.err.EXMLException

Suggestions if any,would be highly appreciated.

Thnx in advance,
Ranjit.