com.h3xstream.findsecbugs.common
Class ByteCode

java.lang.Object
  extended by com.h3xstream.findsecbugs.common.ByteCode

public class ByteCode
extends Object


Constructor Summary
ByteCode()
           
 
Method Summary
static
<T> T
getConstantLDC(org.apache.bcel.generic.InstructionHandle h, org.apache.bcel.generic.ConstantPoolGen cpg, Class<T> clazz)
          Get the constant value of the given instruction.
static
<T> T
getPrevInstruction(org.apache.bcel.generic.InstructionHandle startHandle, Class<T> clazz)
          Get the previous instruction matching the given type of instruction (second parameter)
static Number getPushNumber(org.apache.bcel.generic.InstructionHandle h)
          Extract the number from a push operation (BIPUSH/SIPUSH).
static void printOpCode(org.apache.bcel.generic.Instruction ins, org.apache.bcel.generic.ConstantPoolGen cpg)
          Print the the detail of the given instruction (class, method, etc.)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteCode

public ByteCode()
Method Detail

printOpCode

public static void printOpCode(org.apache.bcel.generic.Instruction ins,
                               org.apache.bcel.generic.ConstantPoolGen cpg)
Print the the detail of the given instruction (class, method, etc.)

Parameters:
ins - Instruction
cpg - Constant Pool

getConstantLDC

public static <T> T getConstantLDC(org.apache.bcel.generic.InstructionHandle h,
                                   org.apache.bcel.generic.ConstantPoolGen cpg,
                                   Class<T> clazz)
Get the constant value of the given instruction. (The instruction must refer to the Constant Pool otherwise null is return)

Type Parameters:
T -
Parameters:
h -
cpg -
clazz -
Returns:

getPushNumber

public static Number getPushNumber(org.apache.bcel.generic.InstructionHandle h)
Extract the number from a push operation (BIPUSH/SIPUSH).

Parameters:
h -
Returns:

getPrevInstruction

public static <T> T getPrevInstruction(org.apache.bcel.generic.InstructionHandle startHandle,
                                       Class<T> clazz)
Get the previous instruction matching the given type of instruction (second parameter)

Type Parameters:
T -
Parameters:
startHandle -
clazz - Type of instruction to look for
Returns:


Copyright © 2015. All rights reserved.