public class DefaultEnvironment extends java.lang.Object implements Environment
The DefaultEnvironment implements the Environment interface
using the JDK class System. Instances of this class are
returned by the singleton EnvironmentProvider (EnvironmentProvider.getEnvironment(java.lang.Object))
if there is no other Environment available for the caller.
Environment,
EnvironmentProvider| Constructor and Description |
|---|
DefaultEnvironment() |
| Modifier and Type | Method and Description |
|---|---|
java.io.PrintStream |
err()
This method returns
System.err, the standard error channel. |
void |
exit()
This method exits the instance of its
Environment implementation. |
int |
getExitStatus()
Retrieving the currently set exit code.
|
java.io.InputStream |
in()
This method returns
System.in, the standard input channel. |
java.io.PrintStream |
out()
This method returns
System.out, the standard output channel. |
void |
setExitStatus(int status)
This method stores the exit code of an application.
|
public java.io.InputStream in()
System.in, the standard input channel.in in interface EnvironmentInputStream that serves as standard inputSystem.inpublic java.io.PrintStream out()
System.out, the standard output channel.out in interface EnvironmentPrintStream that serves as standard outputSystem.outpublic java.io.PrintStream err()
System.err, the standard error channel.err in interface EnvironmentPrintStream that serves as standard error outputSystem.errpublic void setExitStatus(int status)
setExitStatus in interface Environmentstatus - the exit code of an applicationSystem.exit(int)public int getExitStatus()
getExitStatus in interface Environmentpublic void exit()
throws java.lang.UnsupportedOperationException
Environment implementation.
After calling exit the Environment instance is
generally not any longer usable. In particular, an implementation can choose
to call System.exit(int).exit in interface Environmentjava.lang.UnsupportedOperationException - if the method is not availablesetExitStatus(int),
System.exit(int)