public interface ThreadIO
This service guards the central resource of IO streams. The standard streams are singletons. This service replaces the singletons with special versions that can find a unique stream for each thread. If no stream is associated with a thread, it will use the standard input/output that was originally set.
Modifier and Type | Method and Description |
---|---|
void |
close()
Cancel the streams associated with the current thread.
|
void |
setStreams(InputStream in,
PrintStream out,
PrintStream err)
Associate this streams with the current thread.
|
void setStreams(InputStream in, PrintStream out, PrintStream err)
Ensure that when output is performed on System.in, System.out, System.err it will happen on the given streams.
The streams will automatically be canceled when the bundle that has gotten this service is stopped or returns this service.
in
- InputStream to use for the current thread when System.in is usedout
- PrintStream to use for the current thread when System.out is usederr
- PrintStream to use for the current thread when System.err is usedvoid close()
This method will not do anything when no streams are associated.
Copyright © 2006–2024 The Apache Software Foundation. All rights reserved.