Package serp.bytecode.lowlevel
Class ConstantPoolTable
java.lang.Object
serp.bytecode.lowlevel.ConstantPoolTable
Efficient representation of the constant pool as a table. This class
can be used to parse out bits of information from bytecode without
instantiating a full
BCClass.- Author:
- Abe White
-
Constructor Summary
ConstructorsConstructorDescriptionConstantPoolTable(byte[] b) Constructor; supply class bytecode.Constructor; supply input stream to bytecode. -
Method Summary
Modifier and TypeMethodDescriptionintget(int idx) Return the given table entry.intReturn the index into the bytecode of the end of the constant pool.static intgetEndIndex(byte[] b) Allows static computation of the byte index after the constant pool without caching constant pool information.static intreadByte(byte[] b, int idx) Read a byte value at the given offset into the given bytecode.intreadByte(int idx) Read a byte value at the given offset.static intreadInt(byte[] b, int idx) Read an int value at the given offset into the given bytecode.intreadInt(int idx) Read an int value at the given offset.static longreadLong(byte[] b, int idx) Read a long value at the given offset into the given bytecode.longreadLong(int idx) Read a long value at the given offset.static StringreadString(byte[] b, int idx) Read a UTF-8 string value at the given offset into the given bytecode.readString(int idx) Read a UTF-8 string value at the given offset.static intreadUnsignedShort(byte[] b, int idx) Read an unsigned short value at the given offset into the given bytecode.intreadUnsignedShort(int idx) Read an unsigned short value at the given offset.
-
Constructor Details
-
ConstantPoolTable
public ConstantPoolTable(byte[] b) Constructor; supply class bytecode. -
ConstantPoolTable
Constructor; supply input stream to bytecode.- Throws:
IOException
-
-
Method Details
-
getEndIndex
public static int getEndIndex(byte[] b) Allows static computation of the byte index after the constant pool without caching constant pool information. -
readByte
public static int readByte(byte[] b, int idx) Read a byte value at the given offset into the given bytecode. -
readUnsignedShort
public static int readUnsignedShort(byte[] b, int idx) Read an unsigned short value at the given offset into the given bytecode. -
readInt
public static int readInt(byte[] b, int idx) Read an int value at the given offset into the given bytecode. -
readLong
public static long readLong(byte[] b, int idx) Read a long value at the given offset into the given bytecode. -
readString
Read a UTF-8 string value at the given offset into the given bytecode. -
getEndIndex
public int getEndIndex()Return the index into the bytecode of the end of the constant pool. -
get
public int get(int idx) Return the given table entry. -
readByte
public int readByte(int idx) Read a byte value at the given offset. -
readUnsignedShort
public int readUnsignedShort(int idx) Read an unsigned short value at the given offset. -
readInt
public int readInt(int idx) Read an int value at the given offset. -
readLong
public long readLong(int idx) Read a long value at the given offset. -
readString
Read a UTF-8 string value at the given offset.
-