FileDocCategorySizeDatePackage
InsnReadEnv.javaAPI DocGlassfish v2 API3975Fri May 04 22:34:28 BST 2007com.sun.jdo.api.persistence.enhancer.classfile

InsnReadEnv

public class InsnReadEnv extends Object
Environment for decoding byte codes into instructions

Fields Summary
private CodeEnv
codeEnv
private byte[]
byteCodes
private int
currPc
Constructors Summary
InsnReadEnv(byte[] bytes, CodeEnv codeEnv)
Constructor

    this.byteCodes = bytes;
    this.currPc = 0;
    this.codeEnv = codeEnv;
  
Methods Summary
intcurrentPC()
Return the index of the next instruction to decode

    return currPc;
  
bytegetByte()
Get a single byte from the byte code stream

    if (!more())
        throw new InsnError("out of byte codes");//NOI18N

    return byteCodes[currPc++];
  
intgetInt()
Get an int from the byte code stream

    byte byte1 = byteCodes[currPc++];
    byte byte2 = byteCodes[currPc++];
    byte byte3 = byteCodes[currPc++];
    byte byte4 = byteCodes[currPc++];
    return (byte1 << 24) | ((byte2 & 0xff) << 16) |
	    ((byte3  & 0xff) << 8) | (byte4 & 0xff);
  
intgetShort()
Get a short from the byte code stream

    byte byte1 = byteCodes[currPc++];
    byte byte2 = byteCodes[currPc++];
    return (byte1 << 8) | (byte2 & 0xff);
  
InsnTargetgetTarget(int targ)
Get the canonical InsnTarget instance for the specified pc within the method.

    return codeEnv.getTarget(targ);
  
intgetUByte()
Get a single unsigned byte from the byte code stream

    return getByte() & 0xff;
  
intgetUShort()
Get an unsigned short from the byte code stream

    return getShort() & 0xffff;
  
booleanmore()
Are there more byte codes to decode?

    return currPc < byteCodes.length;
  
ConstantPoolpool()
Get the constant pool which applies to the method being decoded

    return codeEnv.pool();