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 and Description
    --- | ---
    `static int` | `ARE_OUTPUT_AND_ERROR_SAME_TARGET`
    `static int` | `IS_ERROR_REDIRECTED`
    `static int` | `IS_INPUT_REDIRECTED`
    `static int` | `IS_OUTPUT_REDIRECTED`
    `static int` | `IS_REDIRECTION_REQUESTED`
    `static java.lang.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

    All Methods Instance Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default boolean` | `areOutputAndErrorSameTarget(java.lang.Object slot)` Determines whether output and error are the same target.
    `default boolean` | `isErrorRedirected(java.lang.Object slot)` Determines whether this invocation redirects error.
    `default boolean` | `isInputRedirected(java.lang.Object slot)` Determines whether this invocation redirects input.
    `default boolean` | `isOutputRedirected(java.lang.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(java.lang.Object slot)` Determines whether this invocation employs redirection.
    `default java.lang.String` | `readInput(java.lang.Object slot)` Reads the next line from input.
    `default byte[]` | `readInputAsByteArray(java.lang.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 java.lang.String` | `readInputBuffer(java.lang.Object slot)` Reads all remaining items from input separated by the platform specific line-end character(s).
    `default java.lang.String` | `toString(java.lang.Object slot, java.lang.String environmentName)` Create a string rendering of this environment handler with current settings.
    `default void` | `writeError(java.lang.Object slot, byte[] data)` Writes all byte[] data as a single line, does not apply a codepage translation.
    `default void` | `writeError(java.lang.Object slot, java.lang.String line)` Writes a single line of String data.
    `default void` | `writeErrorBuffer(java.lang.Object slot, java.lang.String data)` Writes all String data.
    `default void` | `writeOutput(java.lang.Object slot, byte[] data)` Writes all byte[] data as a single line, does not apply a codepage translation.
    `default void` | `writeOutput(java.lang.Object slot, java.lang.String line)` Writes a single line of String data.
    `default void` | `writeOutputBuffer(java.lang.Object slot, java.lang.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 Detail

    - #### version

          static final java.lang.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 Detail

    - #### 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(java.lang.Object slot)

      Determines whether this invocation employs redirection.
      Returns:
        `true` if redirection is in effect, `false` else

    - #### isInputRedirected

          default boolean isInputRedirected(java.lang.Object slot)

      Determines whether this invocation redirects input.
      Returns:
        `true` if input redirection is in effect, `false` else

    - #### isOutputRedirected

          default boolean isOutputRedirected(java.lang.Object slot)

      Determines whether this invocation redirects output.
      Returns:
        `true` if output redirection is in effect, `false` else

    - #### isErrorRedirected

          default boolean isErrorRedirected(java.lang.Object slot)

      Determines whether this invocation redirects error.
      Returns:
        `true` if error redirection is in effect, `false` else

    - #### areOutputAndErrorSameTarget

          default boolean areOutputAndErrorSameTarget(java.lang.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 java.lang.String readInput(java.lang.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(java.lang.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 java.lang.String readInputBuffer(java.lang.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(java.lang.Object slot,
                                   java.lang.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(java.lang.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(java.lang.Object slot,
                                         java.lang.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(java.lang.Object slot,
                                  java.lang.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(java.lang.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(java.lang.Object slot,
                                        java.lang.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 java.lang.String toString(java.lang.Object slot,
                                            java.lang.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