Class AbstractStreamCommand

java.lang.Object
com.streamconverter.command.AbstractStreamCommand
All Implemented Interfaces:
IStreamCommand
Direct Known Subclasses:
CharacterConvertCommand, ConsumerCommand, ConvertCommand, CsvFilterCommand, CsvNavigateCommand, JsonFilterCommand, JsonNavigateCommand, LineEndingNormalizeCommand, PmdXmlToCsvCommand, PmdXmlToJsonCommand, PmdXmlToMarkdownCommand, SampleStreamCommand, SendHttpCommand, XmlFilterCommand, XmlNavigateCommand

public abstract class AbstractStreamCommand extends Object implements IStreamCommand
Abstract class for stream commands.

This class provides a template for executing commands on input streams and writing the results to output streams.

  • Constructor Details

    • AbstractStreamCommand

      Default constructor.

      Initializes the command with default settings.

  • Method Details

    • execute

      public final 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 automatically logs execution details including: - Command name and execution time - Input/output data sizes - Exception details if execution fails - Performance metrics

      Specified by:
      execute in interface IStreamCommand
      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.
    • executeInternal

      protected abstract void executeInternal(InputStream inputStream, OutputStream outputStream) throws IOException
      Abstract method to be implemented by subclasses for executing the command.
      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.
    • getCommandDetails

      コマンドの詳細情報を取得します。

      サブクラスでオーバーライドして、コマンド固有の設定や状態を返すことができます。 この情報はデバッグログに出力され、問題の診断に役立ちます。

      Returns:
      コマンドの詳細情報