JDK-4209999 : System.java should provide a way to get original in, out, and err streams
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.io
  • Affected Version: 1.2.0,1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: generic,solaris_2.6
  • CPU: generic,sparc
  • Submitted: 1999-02-09
  • Updated: 2007-11-15
  • Resolved: 2007-11-15
Related Reports
Duplicate :  
Description
From: ###@###.###
To: ###@###.###
Subject: In, Out & Err
Date: Tue, 9 Feb 1999 09:12:34 -0000 

In java.lang.System there are three standard streams; in, out and err.
Along with these are three methods to allow the user to set a new stream,
these are; setIn(), setOut(), setErr().

It seems strange that there are not complimentary getIn(), getOut(), and
getErr() methods to return the current streams so that these streams can be
reset to their original reference once tasks have been completed. 

Comments
EVALUATION In general, the best one can hope for with mutable attributes is to be able to query, change, and restore to previous values. System.{in,out,err,setIn(),setOut(),setErr()} support all such usages. The alternative would be to maintain a history of changes to allow unlimited undo/redo, with corresponding leakage of memory. With mutable attributes, it is not always obvious what the "initial" value is. More often, the most recent value is more useful. Closing as "Not a Defect". (Perhaps this was a jocular attempt to persuade the maintainers to add a "System.getOut" method?)
15-11-2007

EVALUATION This may be addressed by the new I/O framework. -- mr@eng 1999/10/28
10-07-0194

WORK AROUND Save the current values of System.{in,out,err} before invoking the System.set{In,Out,Err} methods. -- mr@eng 1999/2/9
02-07-0175