Package com.streamconverter.command
Class ConsumerCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.ConsumerCommand
- All Implemented Interfaces:
IStreamCommand
- Direct Known Subclasses:
CsvValidateCommand
,JsonStreamingValidateCommand
,JsonValidateCommand
,ValidateCommand
Abstract class for commands that consume an input stream and produce an output stream.
This class provides a template method pattern for executing the command, ensuring that the input and output streams are not null. It also provides a method to consume the input stream, which must be implemented by subclasses.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract void
consume
(InputStream inputStream) Abstract method to be implemented by subclasses for consuming the input stream.void
executeInternal
(InputStream inputStream, OutputStream outputStream) Executes the command on the provided input stream and writes the result to the output stream.Methods inherited from class com.streamconverter.command.AbstractStreamCommand
execute, getCommandDetails
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.streamconverter.command.IStreamCommand
execute
-
Constructor Details
-
ConsumerCommand
public ConsumerCommand()Default constructor.Initializes the command with default settings.
-
-
Method Details
-
executeInternal
Executes the command on the provided input stream and writes the result to the output stream.- Specified by:
executeInternal
in 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.
-
consume
Abstract method to be implemented by subclasses for consuming the input stream.- Parameters:
inputStream
- The input stream to read data from.- Throws:
IOException
- If an I/O error occurs during the execution of the command.
-