Class CharacterConvertCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.command.impl.charcode.CharacterConvertCommand
- All Implemented Interfaces:
IStreamCommand
Converts the character encoding of a stream from one encoding to another.
This class extends the AbstractStreamCommand and implements the conversion of character encodings.
-
Constructor Summary
ConstructorsConstructorDescriptionCharacterConvertCommand
(String from, String to) Constructor to initialize the character encodings for conversion. -
Method Summary
Modifier and TypeMethodDescriptionvoid
executeInternal
(InputStream inputStream, OutputStream outputStream) Executes the character encoding conversion 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
-
CharacterConvertCommand
Constructor to initialize the character encodings for conversion.- Parameters:
from
- The source character encoding.to
- The target character encoding.- Throws:
IllegalArgumentException
- if the specified character encodings are not supported.
-
-
Method Details
-
executeInternal
Executes the character encoding conversion 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.
-