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); }


本文标签: 版本 查看 作者