Class CsvFilterCommand

java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.csv.CsvFilterCommand
All Implemented Interfaces:
IStreamCommand

CSV Filter Command Class

This class implements pure data extraction from CSV using column selectors. Unlike CsvNavigateCommand which applies transformations, CsvFilterCommand only extracts/filters columns based on specified column names or indices without any modifications.

Features: - Extract specific columns using column names or indices - Preserve exact data values from extracted columns - Memory-efficient streaming processing - Support for multiple column selection

  • Constructor Details

    • CsvFilterCommand

      public CsvFilterCommand(CSVPath columnSelector, boolean hasHeader)
      Constructor for CSV filtering with single typed column selector.
      Parameters:
      columnSelector - the typed CSVPath to extract
      hasHeader - whether the CSV has a header row
      Throws:
      IllegalArgumentException - if columnSelector is null
  • Method Details

    • create

      public static CsvFilterCommand create(CSVPath columnSelector)
      Factory method for CSV filtering with single typed column selector (assumes header exists).
      Parameters:
      columnSelector - the typed CSVPath to extract
      Returns:
      a CsvFilterCommand instance
    • create

      public static CsvFilterCommand create(CSVPath columnSelector, boolean hasHeader)
      Factory method for CSV filtering with single typed column selector.
      Parameters:
      columnSelector - the typed CSVPath to extract
      hasHeader - whether the CSV has a header row
      Returns:
      a CsvFilterCommand instance
    • getCommandDetails

      Description copied from class: AbstractStreamCommand
      コマンドの詳細情報を取得します。

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

      Overrides:
      getCommandDetails in class AbstractStreamCommand
      Returns:
      コマンドの詳細情報
    • executeInternal

      protected void executeInternal(InputStream inputStream, OutputStream outputStream) throws IOException
      Description copied from class: AbstractStreamCommand
      Abstract method to be implemented by subclasses for executing the command.
      Specified by:
      executeInternal in class AbstractStreamCommand
      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.