public void accept(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoVisitor) throws CoreException { sessionInfoStore.accept(sessionInfoVisitor); executionDataStore.accept(executionDataVisitor); }
/** * Saves the current content into the given output stream. * * @param stream * stream to save content to * @throws IOException * in case of problems while writing to the stream */ public void save(final OutputStream stream) throws IOException { final ExecutionDataWriter dataWriter = new ExecutionDataWriter(stream); sessionInfos.accept(dataWriter); executionData.accept(dataWriter); }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath(), e)); } finally { Closeables.closeQuietly(outputStream); } }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }
private void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); loadSourceFiles(infoStore, dataStore, reports); BufferedOutputStream outputStream = null; try { outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall)); ExecutionDataWriter dataWriter = new ExecutionDataWriter(outputStream); infoStore.accept(dataWriter); dataStore.accept(dataWriter); } catch (IOException e) { throw new SonarException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } finally { Closeables.closeQuietly(outputStream); } }
/** * Merge all reports in reportOverall. * @param reportOverall destination file of merge. * @param reports files to be merged. */ public static void mergeReports(File reportOverall, File... reports) { SessionInfoStore infoStore = new SessionInfoStore(); ExecutionDataStore dataStore = new ExecutionDataStore(); boolean isCurrentVersionFormat = loadSourceFiles(infoStore, dataStore, reports); try (BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(reportOverall))) { Object visitor; if (isCurrentVersionFormat) { visitor = new ExecutionDataWriter(outputStream); } else { visitor = new org.jacoco.previous.core.data.ExecutionDataWriter(outputStream); } infoStore.accept((ISessionInfoVisitor) visitor); dataStore.accept((IExecutionDataVisitor) visitor); } catch (IOException e) { throw new IllegalStateException(String.format("Unable to write overall coverage report %s", reportOverall.getAbsolutePath()), e); } }
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException { ExecFileLoader loader = new ExecFileLoader(); for (File exec : files) { loader.load(exec); } rsp.setContentType("application/octet-stream"); final ExecutionDataWriter dataWriter = new ExecutionDataWriter(rsp.getOutputStream()); loader.getSessionInfoStore().accept(dataWriter); loader.getExecutionDataStore().accept(dataWriter); } };