public final class StdioContext extends Object
Modifier and Type | Method and Description |
---|---|
static StdioContext |
create(InputStream in,
OutputStream out,
OutputStream err)
Create a console I/O context.
|
static StdioContext |
create(InputStream in,
PrintStream out,
PrintStream err)
Create a console I/O context.
|
PrintStream |
getErr()
Get the error stream for this context.
|
InputStream |
getIn()
Get the input stream for this context.
|
PrintStream |
getOut()
Get the output stream for this context.
|
static StdioContext |
getStdioContext()
Get the current console I/O context.
|
static void |
install()
Install the StdioContext streams.
|
static void |
setStdioContextSelector(StdioContextSelector stdioContextSelector)
Set the standard I/O context selector.
|
static void |
uninstall()
Uninstall the StdioContext streams.
|
public static StdioContext create(InputStream in, PrintStream out, PrintStream err) throws SecurityException
in
- the input stream for this contextout
- the output stream for this contexterr
- the error stream for this contextSecurityException
- if the caller does not have the createStdioContext
RuntimePermission
public static StdioContext create(InputStream in, OutputStream out, OutputStream err) throws SecurityException
PrintStream
instances.in
- the input stream for this contextout
- the output stream for this contexterr
- the error stream for this contextSecurityException
- if the caller does not have the createStdioContext
RuntimePermission
public static StdioContext getStdioContext()
public InputStream getIn()
public PrintStream getOut()
public PrintStream getErr()
public static void install() throws SecurityException, IllegalStateException
SecurityException
- if the caller does not have the installStdioContextSelector
RuntimePermission
IllegalStateException
- if the streams are already installedpublic static void uninstall() throws SecurityException, IllegalStateException
SecurityException
- if the caller does not have the installStdioContextSelector
RuntimePermission
IllegalStateException
- if the streams are already uninstalledpublic static void setStdioContextSelector(StdioContextSelector stdioContextSelector) throws SecurityException
setStdioContextSelector
RuntimePermission
in
order to invoke this method.stdioContextSelector
- the selector to useSecurityException
- if the caller does not have the installStdioContextSelector
RuntimePermission
Copyright © 2013 JBoss, a division of Red Hat, Inc.