Interface IStreamCommand

All Known Implementing Classes:
AbstractStreamCommand, CharacterConvertCommand, ConsumerCommand, ContextPropagatingDecorator, ConvertCommand, CsvFilterCommand, CsvNavigateCommand, CsvValidateCommand, JsonFilterCommand, JsonNavigateCommand, JsonStreamingValidateCommand, JsonValidateCommand, LineEndingNormalizeCommand, LoggingDecorator, PmdXmlToCsvCommand, PmdXmlToJsonCommand, PmdXmlToMarkdownCommand, SampleStreamCommand, SendHttpCommand, ValidateCommand, XmlFilterCommand, XmlNavigateCommand

public interface IStreamCommand
Unified interface for stream commands with optional execution context support.

This interface defines methods for executing commands on input streams and writing results to output streams. Commands can optionally utilize ExecutionContext for enhanced logging, traceability, and multi-threaded context propagation.

Implementation options:

  • Basic commands: Implement only the 2-parameter execute method
  • Context-aware commands: Override the 3-parameter execute method for enhanced functionality
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    execute(InputStream inputStream, OutputStream outputStream)
    Executes the command on the provided input stream and writes the result to the output stream.
    default void
    execute(InputStream inputStream, OutputStream outputStream, ExecutionContext context)
    Executes the command with ExecutionContext support for enhanced traceability.
  • Method Details

    • execute

      default void execute(InputStream inputStream, OutputStream outputStream, ExecutionContext context) throws IOException
      Executes the command with ExecutionContext support for enhanced traceability.

      This is the primary execution method that supports MDC context propagation, execution tracking, and enhanced logging capabilities.

      Parameters:
      inputStream - The input stream to read data from.
      outputStream - The output stream to write data to.
      context - The execution context for traceability and logging enhancement.
      Throws:
      IOException - If an I/O error occurs during the execution of the command.
    • execute

      void execute(InputStream inputStream, OutputStream outputStream) throws IOException
      Executes the command on the provided input stream and writes the result to the output stream.

      This method maintains backward compatibility for existing implementations. When called without ExecutionContext, a new context will be automatically created by the StreamConverter pipeline.

      Parameters:
      inputStream - The input stream to read data from.
      outputStream - The output stream to write data to.
      Throws:
      IOException - If an I/O error occurs during the execution of the command.