aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.agent/src
diff options
context:
space:
mode:
authorMarc R. Hoffmann <hoffmann@mountainminds.com>2010-01-01 20:19:25 +0000
committerMarc R. Hoffmann <hoffmann@mountainminds.com>2010-01-01 20:19:25 +0000
commit0b358f2c7a4d3e2784ad7f5c6255a5aa13625e43 (patch)
tree580b5060b736077a913475db16f38072f01a5ec1 /org.jacoco.agent/src
parente791602c7b6417c3ee39ea52784328b253febf67 (diff)
downloadjacoco-0b358f2c7a4d3e2784ad7f5c6255a5aa13625e43.tar.gz
#50: New bundle for agent resource.
Diffstat (limited to 'org.jacoco.agent/src')
-rw-r--r--org.jacoco.agent/src/org/jacoco/agent/AgentJar.java52
1 files changed, 52 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
new file mode 100644
index 00000000..73a4f480
--- /dev/null
+++ b/org.jacoco.agent/src/org/jacoco/agent/AgentJar.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Mountainminds GmbH & Co. KG and others
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc R. Hoffmann - initial API and implementation
+ *
+ * $Id: $
+ *******************************************************************************/
+package org.jacoco.agent;
+
+import java.io.InputStream;
+import java.net.URL;
+
+/**
+ * API to access the agent JAR file as a resource.
+ *
+ * @author Marc R. Hoffmann
+ * @version $Revision: $
+ */
+public class AgentJar {
+
+ /**
+ * Name of the agent JAR file resource within this bunde.
+ */
+ public static final String RESOURCE = "/jacocoagent.jar";
+
+ private AgentJar() {
+ }
+
+ /**
+ * Returns a URL pointing to the JAR file.
+ *
+ * @return URL of the JAR file
+ */
+ public static URL getResource() {
+ return AgentJar.class.getResource(RESOURCE);
+ }
+
+ /**
+ * Returns the content of the JAR file as a stream.
+ *
+ * @return content of the JAR file
+ */
+ public static InputStream getResourceAsStream() {
+ return AgentJar.class.getResourceAsStream(RESOURCE);
+ }
+
+}