Package com.streamconverter.command.impl
Class LineEndingNormalizeCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.LineEndingNormalizeCommand
- All Implemented Interfaces:
IStreamCommand
Line ending normalization command.
This command normalizes line endings in text streams to a specified format. It can convert between different line ending styles (Unix LF, Windows CRLF, classic Mac CR) or preserve the input format.
The command processes data efficiently while preserving the exact structure of the input, including whether the input ends with a line terminator.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSupported line ending types for normalization. -
Field Summary
Fields inherited from class com.streamconverter.command.AbstractStreamCommand
log -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new line ending normalization command. -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(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
-
Constructor Details
-
LineEndingNormalizeCommand
Creates a new line ending normalization command.- Parameters:
targetType- the target line ending type to convert to- Throws:
NullPointerException- if targetType is null
-
-
Method Details
-
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.
-