Package org.rexxla.bsf.engines.rexx

# Interface RexxRedirectingCommandHandler

All Superinterfaces:
  `RexxCommandHandler`, `RexxHandler`

All Known Implementing Classes:
  `AbstractRedirectingCommandHandler`, `JavaDrawingHandler`

public interface RexxRedirectingCommandHandler extends RexxCommandHandler
Interface class for Rexx redirecting command handlers. Cf. ooRexx' `rexxapi.pdf` documentation. Defines all new redirecting methods as default methods.

    ------------------------ Apache Version 2.0 license -------------------------
        Copyright (C) 2022 Rony G. Flatscher

        Licensed under the Apache License, Version 2.0 (the "License");
        you may not use this file except in compliance with the License.
        You may obtain a copy of the License at

            http://www.apache.org/licenses/LICENSE-2.0

        Unless required by applicable law or agreed to in writing, software
        distributed under the License is distributed on an "AS IS" BASIS,
        WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        See the License for the specific language governing permissions and
        limitations under the License.
     -----------------------------------------------------------------------------

Since:
  2022-08-22 (BSF4ooRexx 850, baseline Java=8, ooRexx=5.0)
Version:
  850.0
Author:
  Rony G. Flatscher

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `ARE_OUTPUT_AND_ERROR_SAME_TARGET`
  `static final int`
  `IS_ERROR_REDIRECTED`
  `static final int`
  `IS_INPUT_REDIRECTED`
  `static final int`
  `IS_OUTPUT_REDIRECTED`
  `static final int`
  `IS_REDIRECTION_REQUESTED`
  `static final String`
  `version`
  Version string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default boolean`
  `areOutputAndErrorSameTarget(Object slot)`
  Determines whether output and error are the same target.
  `default boolean`
  `isErrorRedirected(Object slot)`
  Determines whether this invocation redirects error.
  `default boolean`
  `isInputRedirected(Object slot)`
  Determines whether this invocation redirects input.
  `default boolean`
  `isOutputRedirected(Object slot)`
  Determines whether this invocation redirects output.
  `default boolean`
  `isRedirectable()`
  Indicates that the command handler is redirectable (a new feature in ooRexx 5.0).
  `default boolean`
  `isRedirectionRequested(Object slot)`
  Determines whether this invocation employs redirection.
  `default String`
  `readInput(Object slot)`
  Reads the next line from input.
  `default byte[]`
  `readInputAsByteArray(Object slot)`
  Reads the next line from input, does not apply a codepage translation to Java but returns the data as a byte array.
  `default String`
  `readInputBuffer(Object slot)`
  Reads all remaining items from input separated by the platform specific line-end character(s).
  `default String`
  `toString(Object slot, String environmentName)`
  Create a string rendering of this environment handler with current settings.
  `default void`
  `writeError(Object slot, byte[] data)`
  Writes all byte[] data as a single line, does not apply a codepage translation.
  `default void`
  `writeError(Object slot, String line)`
  Writes a single line of String data.
  `default void`
  `writeErrorBuffer(Object slot, String data)`
  Writes all String data.
  `default void`
  `writeOutput(Object slot, byte[] data)`
  Writes all byte[] data as a single line, does not apply a codepage translation.
  `default void`
  `writeOutput(Object slot, String line)`
  Writes a single line of String data.
  `default void`
  `writeOutputBuffer(Object slot, String data)`
  Writes the supplied string data, ooRexx will split it into individual lines at CR-LF boundaries.

  ### Methods inherited from interface org.rexxla.bsf.engines.rexx.RexxCommandHandler

  `handleCommand`

  ### Methods inherited from interface org.rexxla.bsf.engines.rexx.RexxHandler

  `checkCondition, clearCondition, dropContextVariable, getAllContextVariables, getCallerContext, getConditionInfo, getContextVariable, getGlobalEnvironment, getInterpreterVersion, getLanguageLevel, getLocalEnvironment, getNil, haltThread, newArray, newDirectory, newStem, newStringTable, raiseCondition, raiseException, raiseException0, raiseException1, raiseException2, setContextVariable, setContextVariableToNil, setThreadTrace`

- ## Field Details

  - ### version

    static final String version
    Version string indicating version of this class (majorVersion*100+minorVersion concatenated with a dot and the sorted date of last change.
    See Also:
      - Constant Field Values

  - ### IS_REDIRECTION_REQUESTED

    static final int IS_REDIRECTION_REQUESTED
    See Also:
      - Constant Field Values

  - ### IS_INPUT_REDIRECTED

    static final int IS_INPUT_REDIRECTED
    See Also:
      - Constant Field Values

  - ### IS_OUTPUT_REDIRECTED

    static final int IS_OUTPUT_REDIRECTED
    See Also:
      - Constant Field Values

  - ### IS_ERROR_REDIRECTED

    static final int IS_ERROR_REDIRECTED
    See Also:
      - Constant Field Values

  - ### ARE_OUTPUT_AND_ERROR_SAME_TARGET

    static final int ARE_OUTPUT_AND_ERROR_SAME_TARGET
    See Also:
      - Constant Field Values

- ## Method Details

  - ### isRedirectable

    default boolean isRedirectable()
    Indicates that the command handler is redirectable (a new feature in ooRexx 5.0).
    Specified by:
      `isRedirectable` in interface `RexxCommandHandler`
    Returns:
      returns true

  - ### isRedirectionRequested

    default boolean isRedirectionRequested(Object slot)
    Determines whether this invocation employs redirection.
    Returns:
      `true` if redirection is in effect, `false` else

  - ### isInputRedirected

    default boolean isInputRedirected(Object slot)
    Determines whether this invocation redirects input.
    Returns:
      `true` if input redirection is in effect, `false` else

  - ### isOutputRedirected

    default boolean isOutputRedirected(Object slot)
    Determines whether this invocation redirects output.
    Returns:
      `true` if output redirection is in effect, `false` else

  - ### isErrorRedirected

    default boolean isErrorRedirected(Object slot)
    Determines whether this invocation redirects error.
    Returns:
      `true` if error redirection is in effect, `false` else

  - ### areOutputAndErrorSameTarget

    default boolean areOutputAndErrorSameTarget(Object slot)
    Determines whether output and error are the same target.
    Returns:
      `true` if output and error are the same target, `false` else

  - ### readInput

    default String readInput(Object slot)
    Reads the next line from input.
    Returns:
      the line read from input or null if nothing could be read

  - ### readInputAsByteArray

    default byte[] readInputAsByteArray(Object slot)
    Reads the next line from input, does not apply a codepage translation to Java but returns the data as a byte array. Intended for fetching binary data.
    Returns:
      the line read from input or null if nothing could be read

  - ### readInputBuffer

    default String readInputBuffer(Object slot)
    Reads all remaining items from input separated by the platform specific line-end character(s).
    Returns:
      all remaining items from input separated by the platform specific line-end character(s) or null if nothing could be read

  - ### writeOutput

    default void writeOutput(Object slot, String line)
    Writes a single line of String data.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `line` - the String data to write to output

  - ### writeOutput

    default void writeOutput(Object slot, byte[] data)
    Writes all byte[] data as a single line, does not apply a codepage translation. Intended for writing binary data.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `data` - the byte array to write to output

  - ### writeOutputBuffer

    default void writeOutputBuffer(Object slot, String data)
    Writes the supplied string data, ooRexx will split it into individual lines at CR-LF boundaries.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `data` - the String to write to output

  - ### writeError

    default void writeError(Object slot, String line)
    Writes a single line of String data.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `line` - the String data to write to error

  - ### writeError

    default void writeError(Object slot, byte[] data)
    Writes all byte[] data as a single line, does not apply a codepage translation. Intended for writing binary data.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `data` - the byte array to write to error

  - ### writeErrorBuffer

    default void writeErrorBuffer(Object slot, String data)
    Writes all String data.
    Parameters:
      `slot` - opaque argument supplied to the handler methods by the Rexx native code interface
      `data` - the String to write to error

  - ### toString

    default String toString(Object slot, String environmentName)
    Create a string rendering of this environment handler with current settings.
    Specified by:
      `toString` in interface `RexxCommandHandler`
    Parameters:
      `slot` - supply the received slot argument
      `environmentName` - supply the environment name this handler handles
    Returns:
      the string rendering of this instance