I just ran into this question which if you just read the title - RDF/XML Output with Jena - is a fairly specific question about a specific framework. It contains a specific code example of using the Jena API (if pretty much lifted verbatim from the official documentation) and describes what the OP is attempting to achieve and their problem.
However on reading the question properly I find that the actual real question boils down to the following (quoted directly from the question text):
Is there a direct way to convert the data returned by the outputsream into a string (or anything similar that can be returned)? Or do i have to save the data to a file with a fileoutputstream and then convert it again to return it?
So essentially the OP is actually asking for how to convert an OutputStream into a String. I know how to do this and I figure surely this must already be covered elsewhere on StackOverflow so after a quick Google I find this question helpfully titled Get an OutputStream into a String which answers the actual question. I could easily write a short answer that tells the OP what to do but for something so general I would much rather point to an appropriate duplicate question.
Therefore I have noted this in a comment on the question and I have voted to close this as a duplicate.
However I am concerned whether this will be considered as a valid duplicate since non-experts are likely to glance at the question and see two completely different questions and reject/skip the question but the duplicate I have voted for is quite clearly appropriate IMO since it will resolve the OPs actual question.
If closing as a duplicate is not appropriate here what would be the appropriate close reason?
The question is not unclear/too broad/primarily opinion based nor does it belong elsewhere on the SE network so duplicate seems the only appropriate close reason.
Also a down vote as opposed to closing does not seem appropriate either in this case as the OP has shown some clear research effort.