Class CsvNavigateCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.csv.CsvNavigateCommand
- All Implemented Interfaces:
IStreamCommand
CSV Navigate Command Class
This class implements command for targeted CSV transformation using column selectors. It identifies specific columns using column names or indices and applies IRule transformations to those columns while preserving the overall CSV structure.
-
Field Summary
Fields inherited from class com.streamconverter.command.AbstractStreamCommand
log -
Method Summary
Modifier and TypeMethodDescriptionstatic CsvNavigateCommandFactory method for creating a CSV navigation command with typed column selector and rule.static CsvNavigateCommandFactory method for creating a CSV navigation command with TreePath compatibility.static CsvNavigateCommandDeprecated.voidexecute(InputStream inputStream, OutputStream outputStream) Executes the command on the provided input stream and writes the result to the output stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.streamconverter.command.IStreamCommand
commandName, withLogging, withLogging
-
Method Details
-
create
Deprecated.Usecreate(CSVPath, IRule)insteadFactory method for creating a CSV navigation command with explicit rule specification. This method makes the intention explicit: extract data from the specified column and apply the given transformation rule.- Parameters:
columnSelector- the column name or index to select (e.g., "name", "2")rule- the transformation rule to apply to selected column data- Returns:
- a CsvNavigateCommand that extracts the specified column with the given rule
- Throws:
IllegalArgumentException- if rule is null
-
create
Factory method for creating a CSV navigation command with typed column selector and rule.- Parameters:
columnSelector- the typed CSVPath to select columnrule- the transformation rule to apply to selected column data- Returns:
- a CsvNavigateCommand that extracts the specified column with the given rule
- Throws:
IllegalArgumentException- if columnSelector or rule is null
-
create
Factory method for creating a CSV navigation command with TreePath compatibility.- Parameters:
treePath- the TreePath representing column selectorrule- the transformation rule to apply to selected column data- Returns:
- a CsvNavigateCommand that extracts the specified column with the given rule
- Throws:
IllegalArgumentException- if treePath or rule is null
-
execute
Description copied from class:AbstractStreamCommandExecutes the command on the provided input stream and writes the result to the output stream.- Specified by:
executein interfaceIStreamCommand- Specified by:
executein classAbstractStreamCommand- 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.
-
create(CSVPath, IRule)instead