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 Environment
InputStream
that serves as standard inputSystem.in
public java.io.PrintStream out()
System.out
, the standard output channel.out
in interface Environment
PrintStream
that serves as standard outputSystem.out
public java.io.PrintStream err()
System.err
, the standard error channel.err
in interface Environment
PrintStream
that serves as standard error outputSystem.err
public void setExitStatus(int status)
setExitStatus
in interface Environment
status
- the exit code of an applicationSystem.exit(int)
public int getExitStatus()
getExitStatus
in interface Environment
public 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 Environment
java.lang.UnsupportedOperationException
- if the method is not availablesetExitStatus(int)
,
System.exit(int)