diff options
author | Brock Janiczak <brockj@gmail.com> | 2010-01-21 03:51:43 +0000 |
---|---|---|
committer | Brock Janiczak <brockj@gmail.com> | 2010-01-21 03:51:43 +0000 |
commit | 162205aed112236b19e5d4b3b2a4779130a59385 (patch) | |
tree | 4c651cc32adef40cb48af452186f8e2ce45dd444 /org.jacoco.agent/src | |
parent | af24d3c810fb4dd4add260c50be37cc69fbc8965 (diff) | |
download | jacoco-162205aed112236b19e5d4b3b2a4779130a59385.tar.gz |
Missed from previous commit
Adds getResource API to AgentJar to get URL of embedded agent jar
Diffstat (limited to 'org.jacoco.agent/src')
-rw-r--r-- | org.jacoco.agent/src/org/jacoco/agent/AgentJar.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java b/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java index c7a30e2b..97d370e4 100644 --- a/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java +++ b/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java @@ -18,6 +18,7 @@ import java.io.FileOutputStream; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.URL;
/**
* API to access the agent JAR file as a resource.
@@ -36,6 +37,19 @@ public class AgentJar { }
/**
+ * Returns a URL pointing to the JAR file.
+ *
+ * @return URL of the JAR file
+ */
+ public static URL getResource() {
+ final URL url = AgentJar.class.getResource(RESOURCE);
+ if (url == null) {
+ throw new RuntimeException(ERRORMSG);
+ }
+ return url;
+ }
+
+ /**
* Extract the JaCoCo agent jar from the classpath and put it into a
* temporary location. This file should be deleted on exit, but may not if
* the VM is terminated
|