admin 管理员组文章数量: 887021
2024年1月11日发(作者:查看websphere版本)
case 200FILE: return instrumentPack200(utStream(), output, name); default: copy(utStream(), output, name); return 0; } } private int instrumentZip(final InputStream input, final OutputStream output, final String name) throws IOException { final ZipInputStream zipin = new ZipInputStream(input); final ZipOutputStream zipout = new ZipOutputStream(output); ZipEntry entry; int count = 0; while ((entry = nextEntry(zipin, name)) != null) { final String entryName = e(); if (Entry(entryName)) { continue; }
tEntry(new ZipEntry(entryName)); if (!Entry(entryName, zipin, zipout)) { count += instrumentAll(zipin, zipout, name + "@" + entryName); } ntry(); } (); return count; } private ZipEntry nextEntry(final ZipInputStream input, final String location) throws IOException { try { return tEntry(); } catch (final IOException e) { throw instrumentError(location, e); } } private int instrumentGzip(final InputStream input, final OutputStream output, final String name) throws IOException { final GZIPInputStream gzipInputStream; try { gzipInputStream = new GZIPInputStream(input); } catch (final IOException e) { throw instrumentError(name, e); } final GZIPOutputStream gzout = new GZIPOutputStream(output); final int count = instrumentAll(gzipInputStream, gzout, name); (); return count; } private int instrumentPack200(final InputStream input, final OutputStream output, final String name) throws IOException { final InputStream unpackedInput; try { unpackedInput = (input); } catch (final IOException e) { throw instrumentError(name, e); } final ByteArrayOutputStream buffer = new ByteArrayOutputStream(); final int count = instrumentAll(unpackedInput, buffer, name); (Array(), output); return count; } private void copy(final InputStream input, final OutputStream output, final String name) throws IOException { final byte[] buffer = new byte[1024]; int len;
* 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 * /legal/ * * Contributors: * Marc R. Hoffmann - initial API and implementation *
*******************************************************************************/package ;import ctInsnNode;import ;/** * Representation of a byte code instruction for analysis. Internally used for * analysis. */public class Instruction { private final AbstractInsnNode node; private final int line; private int branches; private final BitSet coveredBranches; private Instruction predecessor; private int predecessorBranch; /** * New instruction at the given line. *
* @param node * corresponding node * @param line * source line this instruction belongs to */ public Instruction(final AbstractInsnNode node, final int line) { = node; = line; es = 0; dBranches = new BitSet(); } /** * @return corresponding node */ public AbstractInsnNode getNode() { return node; } /** * Adds an branch to this instruction. */ public void addBranch() { branches++; } /** * Sets the given instruction as a predecessor of this instruction and adds * branch to the predecessor. Probes are inserted in a way that every * instruction has at most one direct predecessor. *
* @see #addBranch() * @param predecessor * predecessor instruction * @param branch
* @param branch * branch number in predecessor that should be marked as covered * when this instruction marked as covered */ public void setPredecessor(final Instruction predecessor, final int branch) { essor = predecessor; nch(); essorBranch = branch; } /** * Marks one branch of this instruction as covered. Also recursively marks * all predecessor instructions as covered if this is the first covered * branch. * * @param branch * branch number to mark as covered */ public void setCovered(final int branch) { Instruction i = this; int b = branch; while (i != null) { if (!y()) { (b); break; } (b); b = essorBranch; i = essor; } } /** * Returns the source line this instruction belongs to. *
* @return corresponding source line */ public int getLine() { return line; } /** * Returns the total number of branches starting from this instruction. *
* @return total number of branches */ public int getBranches() { return branches; } /** * Returns the number of covered branches starting from this instruction. *
* @return number of covered branches */ public int getCoveredBranches() { return ality(); } /** * Merges information about covered branches of given instruction into this * instruction. *
* @param instruction * instruction from which to merge */ public void merge(Instruction instruction) { (dBranches); }
版权声明:本文标题:Jacoco探针源码解析(0.8.5版本) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.freenas.com.cn/free/1704930955h467047.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论