Package dev.enola.common.linereader
Interface ExecutionContext
- All Known Implementing Classes:
ExecutionContextImpl
public interface ExecutionContext
ExecutionContext provides access to the "current execution context", that is the environment, and
IN, OUT and ERR streams - with encodings (or, if none, then
StandardCharsets.ISO_8859_1, but NOT StandardCharsets.US_ASCII). This is useful for any code which needs to access
input or provide output.-
Method Summary
Modifier and TypeMethodDescriptionReturns an immutable map of environment variables specific to this execution.error()Returns the error stream for the current execution.Returns the character encoding to be used for the error stream.input()Returns the input stream for the current execution.Returns the character encoding to be used for the input stream.output()Returns the output stream for the current execution.Returns the character encoding to be used for the output stream.
-
Method Details
-
environment
Returns an immutable map of environment variables specific to this execution. These variables are typically used to configure the process or task currently being executed. Prefer using this over the staticSystem.getenv()in applications which run multiple child processes.- Returns:
- An ImmutableMap of environment variables.
-
input
Returns the input stream for the current execution. This stream is typically used to feed data into the executing process or task. Prefer using this over the staticSystem.inin applications which might process multiple incoming request connections.- Returns:
- The InputStream for input.
-
output
Returns the output stream for the current execution. This stream is typically used to capture output from the executing process or task. Prefer using this over the staticSystem.outin applications which may output to various destinations in parallel.- Returns:
- The OutputStream for output.
-
error
Returns the error stream for the current execution. This stream is typically used to capture error output from the executing process or task. Prefer using this over the staticSystem.err.- Returns:
- The OutputStream for errors.
-
inputCharset
Returns the character encoding to be used for the input stream. This charset must be used to convert characters to bytes when reading frominput().- Returns:
- The Charset for input.
-
outputCharset
Returns the character encoding to be used for the output stream. This charset must be used to convert bytes to characters when writing tooutput().- Returns:
- The Charset for output.
-
errorCharset
Returns the character encoding to be used for the error stream. This charset must be used to convert bytes to characters when writing toerror().- Returns:
- The Charset for errors.
-