Package com.streamconverter
Class StreamConverter
java.lang.Object
com.streamconverter.StreamConverter
ストリーム変換クラス。
ストリームを変換するクラス。ストリームを変換するコマンドを指定して、ストリームを変換する。
ストリームを変換するコマンドは、IStreamCommandインターフェースを実装したクラスである必要がある。
親スレッドのMDCコンテキストは、InheritableMDCAdapterが
インストールされている場合、各コマンドの仮想スレッドに自動的に伝搬される。MDCInitializer.initialize()が呼ばれていない場合、各ワーカースレッドは
独立した空のMDCコンテキストを持ち、親スレッドのMDC値は伝搬されない。
-
Method Summary
Modifier and TypeMethodDescriptionstatic StreamConvertercreate(IStreamCommand... commands) Creates a StreamConverter with the specified array of commands.static StreamConvertercreate(List<IStreamCommand> commands) Creates a StreamConverter with the specified list of commands.voidrun(InputStream inputStream, OutputStream outputStream) 非同期並列処理でストリームを変換する。 メモリ効率を重視し、PipedStreamを使用して大容量ファイルに対応。
-
Method Details
-
create
Creates a StreamConverter with the specified array of commands.- Parameters:
commands- the array of commands to be executed in sequence- Returns:
- a new StreamConverter instance
- Throws:
NullPointerException- if commands is nullIllegalArgumentException- if commands is empty
-
create
Creates a StreamConverter with the specified list of commands.- Parameters:
commands- the list of commands to be executed in sequence- Returns:
- a new StreamConverter instance
- Throws:
NullPointerException- if commands is nullIllegalArgumentException- if commands is empty
-
run
非同期並列処理でストリームを変換する。 メモリ効率を重視し、PipedStreamを使用して大容量ファイルに対応。- Parameters:
inputStream- 処理対象の入力ストリームoutputStream- 処理結果を書き込む出力ストリーム- Throws:
IOException- ストリーム処理中にI/Oエラーが発生した場合
-