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 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 static System.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 static System.in in 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 static System.out in 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 static System.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 from input().
      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 to output().
      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 to error().
      Returns:
      The Charset for errors.