Package com.streamconverter.sloc.command
Class SlocAggregateCommand
java.lang.Object
com.streamconverter.command.AbstractStreamCommand
com.streamconverter.sloc.command.SlocAggregateCommand
- All Implemented Interfaces:
IStreamCommand
ModuleSloc オブジェクトのストリームを集約して合計行を追加するコマンド。
入力: JacocoXmlToModuleSlocCommand が出力する ObjectOutputStream ストリーム
出力: 各 ModuleSloc + 合計を表す ModuleSloc("Total", ...) を ObjectOutputStream
で書き出す
1件ずつ読みながら即座に書き出し、カウントのみ累積するためモジュール数によらずメモリ使用量は O(1)。
セキュリティ前提: 入力ストリームは同一 JVM 内の前段コマンド(JacocoXmlToModuleSlocCommand)が書き出したものであり、外部入力を直接受け取らない。予期しない型が 含まれる場合は ClassNotFoundException / ClassCastException を IOException に変換して伝播する。
-
Field Summary
Fields inherited from class com.streamconverter.command.AbstractStreamCommand
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidexecute(InputStream input, OutputStream output) 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
-
SlocAggregateCommand
public SlocAggregateCommand()
-
-
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:
input- The input stream to read data from.output- The output stream to write data to.- Throws:
IOException- If an I/O error occurs during the execution of the command.
-