Package org.jacoco.core.data
Class ExecutionDataReader
- java.lang.Object
-
- org.jacoco.core.data.ExecutionDataReader
-
- Direct Known Subclasses:
RemoteControlReader
public class ExecutionDataReader extends java.lang.ObjectDeserialization of execution data from binary streams.
-
-
Field Summary
Fields Modifier and Type Field Description private IExecutionDataVisitorexecutionDataVisitorprivate booleanfirstBlockprotected CompactDataInputinUnderlying data inputprivate ISessionInfoVisitorsessionInfoVisitor
-
Constructor Summary
Constructors Constructor Description ExecutionDataReader(java.io.InputStream input)Creates a new reader based on the given input stream input.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanread()Reads all data and reports it to the corresponding visitors.protected booleanreadBlock(byte blocktype)Reads a block of data identified by the given id.private voidreadExecutionData()private voidreadHeader()private voidreadSessionInfo()voidsetExecutionDataVisitor(IExecutionDataVisitor visitor)Sets an listener for execution data.voidsetSessionInfoVisitor(ISessionInfoVisitor visitor)Sets an listener for session information.
-
-
-
Field Detail
-
in
protected final CompactDataInput in
Underlying data input
-
sessionInfoVisitor
private ISessionInfoVisitor sessionInfoVisitor
-
executionDataVisitor
private IExecutionDataVisitor executionDataVisitor
-
firstBlock
private boolean firstBlock
-
-
Constructor Detail
-
ExecutionDataReader
public ExecutionDataReader(java.io.InputStream input)
Creates a new reader based on the given input stream input. Depending on the nature of the underlying stream input should be buffered as most data is read in single bytes.- Parameters:
input- input stream to read execution data from
-
-
Method Detail
-
setSessionInfoVisitor
public void setSessionInfoVisitor(ISessionInfoVisitor visitor)
Sets an listener for session information.- Parameters:
visitor- visitor to retrieve session info events
-
setExecutionDataVisitor
public void setExecutionDataVisitor(IExecutionDataVisitor visitor)
Sets an listener for execution data.- Parameters:
visitor- visitor to retrieve execution data events
-
read
public boolean read() throws java.io.IOException, IncompatibleExecDataVersionExceptionReads all data and reports it to the corresponding visitors. The stream is read until its end or a command confirmation has been sent.- Returns:
trueif additional data can be expected after a command has been executed.falseif the end of the stream has been reached.- Throws:
java.io.IOException- might be thrown by the underlying input streamIncompatibleExecDataVersionException- incompatible data version from different JaCoCo release
-
readBlock
protected boolean readBlock(byte blocktype) throws java.io.IOExceptionReads a block of data identified by the given id. Subclasses may overwrite this method to support additional block types.- Parameters:
blocktype- block type- Returns:
trueif there are more blocks to read- Throws:
java.io.IOException- might be thrown by the underlying input stream
-
readHeader
private void readHeader() throws java.io.IOException- Throws:
java.io.IOException
-
readSessionInfo
private void readSessionInfo() throws java.io.IOException- Throws:
java.io.IOException
-
readExecutionData
private void readExecutionData() throws java.io.IOException- Throws:
java.io.IOException
-
-