Package mockit.asm.util
Class BytecodeReader
java.lang.Object
mockit.asm.util.BytecodeReader
- Direct Known Subclasses:
AnnotatedReader
,AnnotationReader
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
BytecodeReader
(byte[] code) protected
BytecodeReader
(BytecodeReader another) -
Method Summary
Modifier and TypeMethodDescriptionprotected final boolean
readBoolean
(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) protected final char
readChar
(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) protected final String
Reads the class name from the constant pool, incrementingcodeIndex
by 2.protected final Object
readConst
(@org.checkerframework.checker.index.qual.NonNegative int itemIndex) Reads a numeric or string constant pool item incode
.final Object
protected final Object
readConstItem
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) final double
protected final double
readDouble
(@org.checkerframework.checker.index.qual.NonNegative int s8CodeIndex) final float
protected final float
readFloat
(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) final int
readInt()
protected final int
readInt
(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) Reads a signed int value incode
.final @org.checkerframework.checker.index.qual.NonNegative int
readItem()
final @org.checkerframework.checker.index.qual.NonNegative int
readItem
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) final long
readLong()
protected final long
readLong
(@org.checkerframework.checker.index.qual.NonNegative int s8CodeIndex) Reads a signed long value incode
.final MethodHandle
protected final MethodHandle
readMethodHandleItem
(@org.checkerframework.checker.index.qual.NonNegative int bsmCodeIndex) final String
final String
readNonnullClass
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) final String
final String
readNonnullUTF8
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads the index of an UTF8 item incode
.protected final short
protected final short
readShort
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads a signed short value incode
.final int
final String
readString
(@org.checkerframework.checker.index.qual.NonNegative int itemIndex) Reads a string instrings
at the given index.final @org.checkerframework.checker.index.qual.NonNegative int
protected final @org.checkerframework.checker.index.qual.NonNegative int
readUnsignedByte
(@org.checkerframework.checker.index.qual.NonNegative int u1CodeIndex) Reads an unsigned byte value incode
.final @org.checkerframework.checker.index.qual.NonNegative int
protected final @org.checkerframework.checker.index.qual.NonNegative int
readUnsignedShort
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads an unsigned short value incode
.protected final String
readUTF8()
protected final String
readUTF8
(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads an UTF8 string constant pool item incode
.
-
Field Details
-
code
@NonNull public final byte[] codeThe class to be parsed. The content of this array must not be modified. -
items
@NonNull public final int[] itemsThe start index of each constant pool item incode
, plus one. The one byte offset skips the constant pool item tag that indicates its type. -
codeIndex
public @org.checkerframework.checker.index.qual.NonNegative int codeIndexThe next index atcode
to be read.
-
-
Constructor Details
-
BytecodeReader
protected BytecodeReader(@NonNull byte[] code) -
BytecodeReader
-
-
Method Details
-
readUnsignedByte
public final @org.checkerframework.checker.index.qual.NonNegative int readUnsignedByte()- Returns:
- the int
-
readUnsignedByte
protected final @org.checkerframework.checker.index.qual.NonNegative int readUnsignedByte(@org.checkerframework.checker.index.qual.NonNegative int u1CodeIndex) Reads an unsigned byte value incode
.- Parameters:
u1CodeIndex
- the start index of the value to be read incode
- Returns:
- the int
-
readSignedByte
public final int readSignedByte()- Returns:
- the int
-
readChar
protected final char readChar(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) -
readBoolean
protected final boolean readBoolean(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) -
readUnsignedShort
public final @org.checkerframework.checker.index.qual.NonNegative int readUnsignedShort()- Returns:
- the int
-
readUnsignedShort
protected final @org.checkerframework.checker.index.qual.NonNegative int readUnsignedShort(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads an unsigned short value incode
.- Parameters:
u2CodeIndex
- the start index of the value to be read incode
- Returns:
- the int
-
readShort
protected final short readShort()- Returns:
- the short
-
readShort
protected final short readShort(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads a signed short value incode
.- Parameters:
u2CodeIndex
- the start index of the value to be read incode
- Returns:
- the short
-
readInt
public final int readInt()- Returns:
- the int
-
readInt
protected final int readInt(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) Reads a signed int value incode
.- Parameters:
s4CodeIndex
- the start index of the value to be read incode
- Returns:
- the int
-
readLong
public final long readLong()- Returns:
- the long
-
readLong
protected final long readLong(@org.checkerframework.checker.index.qual.NonNegative int s8CodeIndex) Reads a signed long value incode
.- Parameters:
s8CodeIndex
- the start index of the value to be read incode
- Returns:
- the long
-
readDouble
public final double readDouble() -
readDouble
protected final double readDouble(@org.checkerframework.checker.index.qual.NonNegative int s8CodeIndex) -
readFloat
public final float readFloat() -
readFloat
protected final float readFloat(@org.checkerframework.checker.index.qual.NonNegative int s4CodeIndex) -
readUTF8
- Returns:
- the String corresponding to the UTF8 item, or
null
ifcodeIndex
points to an item whose value is zero
-
readUTF8
@Nullable protected final String readUTF8(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads an UTF8 string constant pool item incode
.- Parameters:
u2CodeIndex
- the index of an unsigned short value incode
, whose value is the index of an UTF8 constant pool item- Returns:
- the String corresponding to the UTF8 item, or
null
if index is zero or points to an item whose value is zero
-
readNonnullUTF8
- Returns:
- the UTF8 string found in
strings
at that index
-
readNonnullUTF8
@NonNull public final String readNonnullUTF8(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) Reads the index of an UTF8 item incode
.- Parameters:
u2CodeIndex
- the u 2 code index- Returns:
- the UTF8 string found in
strings
at that index
-
readString
@NonNull public final String readString(@org.checkerframework.checker.index.qual.NonNegative int itemIndex) Reads a string instrings
at the given index.- Parameters:
itemIndex
- the item index- Returns:
- the string
-
readConstItem
- Returns:
- the UTF8 string found in
strings
at that index
-
readConstItem
@NonNull protected final Object readConstItem(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) -
readConst
@NonNull protected final Object readConst(@org.checkerframework.checker.index.qual.NonNegative int itemIndex) Reads a numeric or string constant pool item incode
. -
readMethodHandle
-
readMethodHandleItem
@NonNull protected final MethodHandle readMethodHandleItem(@org.checkerframework.checker.index.qual.NonNegative int bsmCodeIndex) -
readClass
Reads the class name from the constant pool, incrementingcodeIndex
by 2.- Returns:
- the string
-
readNonnullClass
- Returns:
- the string
-
readNonnullClass
@NonNull public final String readNonnullClass(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex) -
readItem
public final @org.checkerframework.checker.index.qual.NonNegative int readItem()- Returns:
- the item at that index in
items
-
readItem
public final @org.checkerframework.checker.index.qual.NonNegative int readItem(@org.checkerframework.checker.index.qual.NonNegative int u2CodeIndex)
-