aboutsummaryrefslogtreecommitdiff
path: root/org.jacoco.agent.rt/src
diff options
context:
space:
mode:
authorMarc Hoffmann <marc.hoffmann@sbb.ch>2013-01-08 16:04:44 +0100
committerMarc Hoffmann <marc.hoffmann@sbb.ch>2013-01-08 16:04:44 +0100
commit538dc38bbc0d8b3d7c01f053ac232e84a1cf34e2 (patch)
tree1a7d44e4291e19c0ae2144610308d7278be7abf2 /org.jacoco.agent.rt/src
parent2a8b5339c422de268cae3a862a85666a9b0ac176 (diff)
downloadjacoco-538dc38bbc0d8b3d7c01f053ac232e84a1cf34e2.tar.gz
Use outFile and merge parameters of EMMA of compatibility API.
Diffstat (limited to 'org.jacoco.agent.rt/src')
-rw-r--r--org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java40
1 files changed, 25 insertions, 15 deletions
diff --git a/org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java b/org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java
index 2cdb8136..6096e4b9 100644
--- a/org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java
+++ b/org.jacoco.agent.rt/src/com/vladium/emma/rt/RT.java
@@ -12,10 +12,14 @@
package com.vladium.emma.rt;
import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
/**
* Compatibility layer for the EMMA runtime which allows to trigger dumps
- * through EMMA APIs.
+ * through EMMA APIs. Note that even this class emulates an EMMA API the files
+ * written are in JaCoCo execution data format.
*
* @deprecated Use {@link org.jacoco.agent.rt.IAgent} instead.
*/
@@ -26,38 +30,44 @@ public final class RT {
}
/**
- * Triggers an execution data dump for the configured output without
- * performing a reset.
+ * Writes the current execution data to the given file in JaCoCo execution
+ * data format.
*
* @param outFile
- * ignored
+ * file to write execution data to
* @param merge
- * ignored
+ * if <code>true</code>, execution data is appended to an
+ * existing file
* @param stopDataCollection
* ignored
- * @throws Exception
- * @see org.jacoco.agent.rt.IAgent#dump(boolean)
+ * @throws IOException
+ * in case of problems with the file output
*/
@SuppressWarnings("unused")
public static void dumpCoverageData(final File outFile,
final boolean merge, final boolean stopDataCollection)
- throws Exception {
- org.jacoco.agent.rt.RT.getAgent().dump(false);
+ throws IOException {
+ final OutputStream out = new FileOutputStream(outFile, merge);
+ try {
+ out.write(org.jacoco.agent.rt.RT.getAgent().getExecutionData(false));
+ } finally {
+ out.close();
+ }
}
/**
- * Triggers an execution data dump for the configured output without
- * performing a reset.
+ * Writes the current execution data to the given file in JaCoCo execution
+ * data format. If the file already exists new data is appended.
*
* @param outFile
- * ignored
+ * file to write execution data to
* @param stopDataCollection
* ignored
- * @throws Exception
- * @see org.jacoco.agent.rt.IAgent#dump(boolean)
+ * @throws IOException
+ * in case of problems with the file output
*/
public static synchronized void dumpCoverageData(final File outFile,
- final boolean stopDataCollection) throws Exception {
+ final boolean stopDataCollection) throws IOException {
dumpCoverageData(outFile, true, stopDataCollection);
}