Package org.jacoco.agent
Class AgentJar
java.lang.Object
org.jacoco.agent.AgentJar
API to access the agent JAR file as a resource. While the agent is a JAR file
it is considered as a plain resource that must be configured for the
application under test (target JVM). The agent JAR does not provide any
public Java API.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Extract the JaCoCo agent JAR and put it into the specified location.static File
Extract the JaCoCo agent JAR and put it into a temporary location.static URL
Returns a URL pointing to the JAR file.static InputStream
Returns the content of the JAR file as a stream.private static void
Close a stream ignoring any error
-
Field Details
-
RESOURCE
Name of the agent JAR file resource within this bundle.- See Also:
-
ERRORMSG
-
-
Constructor Details
-
AgentJar
private AgentJar()
-
-
Method Details
-
getResource
Returns a URL pointing to the JAR file.- Returns:
- URL of the JAR file
-
getResourceAsStream
Returns the content of the JAR file as a stream.- Returns:
- content of the JAR file
-
extractToTempLocation
Extract the JaCoCo agent JAR and put it into a temporary location. This file should be deleted on exit, but may not if the VM is terminated- Returns:
- Location of the Agent Jar file in the local file system. The file should exist and be readable.
- Throws:
IOException
- Unable to unpack agent jar
-
extractTo
Extract the JaCoCo agent JAR and put it into the specified location.- Parameters:
destination
- Location to write JaCoCo Agent Jar to. Must be writeable- Throws:
IOException
- Unable to unpack agent jar
-
safeClose
Close a stream ignoring any error- Parameters:
closeable
- stream to be closed
-