| Author |
StreamResult to a String?
|
Scott Simpson
Greenhorn
Joined: Mar 03, 2005
Posts: 3
|
|
I need to figure out how to make something go from a StreamResult into a String in this: the StreamResult param of that would usually take a FileStream or something, but i need it in a String or StringBuffer format. Can anyone help me? THanks in advance
|
-scott-<br />trying to like java
|
 |
Horatio Westock
Ranch Hand
Joined: Feb 23, 2005
Posts: 221
|
|
Hi. You could write a StringOutputStream that extends OutputStream, then pass that to the approriate constructor of StreamResult. It should be fairly simple to implement with a StringBuffer at it's core. In fact, a cursory glance at google came up with this implementation which you could draw inspiration from. Hope this helps. /edit Ignore me, I'm being silly! Just use StringWriter e.g. [ March 08, 2005: Message edited by: Horatio Westock ]
|
 |
Scott Simpson
Greenhorn
Joined: Mar 03, 2005
Posts: 3
|
|
|
thanks a bunch! that last bit is exactly what i needed. wasn't too familiar with the StreamResult stuff.
|
 |
David Harkness
Ranch Hand
Joined: Aug 07, 2003
Posts: 1646
|
|
Originally posted by Scott Simpson: trying to like java
Do, or do not. There is no try. Sorry, couldn't resist.
|
 |
Ilja Preuss
author
Sheriff
Joined: Jul 11, 2001
Posts: 14112
|
|
Originally posted by David Harkness: Do, or do not. There is no try. Sorry, couldn't resist.
"Do and Undo. There is always try." - Ronald E. Jeffries
|
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
|
 |
 |
|
|
subject: StreamResult to a String?
|
|
|