Results 1 to 4 of 4
- 12-03-2011, 09:36 AM #1
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
Is it possible to capture println data inside variable?
I am working on some very clunky code that someone else has written. For some reason they decided to write all their functions as void, none of them return anything. Instead she was using println very often.
Is there a way I can capture the data being outputted by println? I wan to display this data in a GUI which is why I need this in String not print.
Many thanks in advance.
- 12-03-2011, 09:54 AM #2
Senior Member
- Join Date
- Oct 2010
- Location
- Germany
- Posts
- 780
- Rep Power
- 4
Re: Is it possible to capture println data inside variable?
Sure, write your own printstream and use System.setOut
System (Java Platform SE 6)
- 12-03-2011, 10:00 AM #3
Senior Member
- Join Date
- Feb 2011
- Posts
- 107
- Rep Power
- 0
- 12-03-2011, 02:36 PM #4
Re: Is it possible to capture println data inside variable?
That may provide a workable short-term solution, but it's exceedingly brittle. Far better to rewrite or add methods that return meaningful values -- a Model -- and redevelop the app on MVC lines.
dbWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Using JSTL to capture HTTP referer data and serialize into a variable
By jeremy.wilson in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 05-19-2011, 12:44 PM -
replace inside the println
By javauserjava in forum New To JavaReplies: 24Last Post: 04-06-2011, 01:12 AM -
how to capture jsf form data
By Srikala in forum JavaServer Faces (JSF)Replies: 2Last Post: 07-16-2009, 09:06 AM -
Help require to capture streaming data
By jobseeker in forum Java ServletReplies: 1Last Post: 04-02-2009, 09:18 PM -
println doesn't print from inside for loop, et.al.
By rdtindsm in forum New To JavaReplies: 5Last Post: 03-27-2009, 01:19 PM


1Likes
LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks