java.lang.Object
org.glavo.classfile.impl.ClassReaderImpl
- All Implemented Interfaces:
Iterable<PoolEntry>,ClassReader,ConstantPool
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of entries in the bootstrap method table.bootstrapMethodEntry(int index) Returns theBootstrapMethodEntryat the specified index within the bootstrap method table.intReturns the length of the classfile, in bytes.booleanCompare a range of bytes from the classfile to a range of bytes within aBufWriter.context()voidcopyBytesTo(BufWriter buf, int p, int len) Copy a range of bytes from the classfile to aBufWriterReturns the table of custom attribute mappers.entryByIndex(int index) Returns the entry at the specified index.intflags()Returns the access flags for the class, as a bit mask.byte[]readBytes(int p, int len) Returns a copy of the bytes at the specified range in the classfile.readClassEntry(int pos) Returns the class entry whose index is given at the specified offset within the classfile.doublereadDouble(int p) Returns the double value at the specified offset within the classfile.readEntry(int pos) Returns the constant pool entry whose index is given at the specified offset within the classfile.<T extends PoolEntry>
TReturns the constant pool entry of a given type whose index is given at the specified offset within the classfile.readEntryOrNull(int pos) Returns the constant pool entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero.floatreadFloat(int p) Returns the float value at the specified offset within the classfile.intreadInt(int p) Returns the signed int at the specified offset within the classfile.longreadLong(int p) Returns the signed long at the specified offset within the classfile.readMethodHandleEntry(int pos) Returns the method handle entry whose index is given at the specified offset within the classfile.readModuleEntry(int pos) Returns the module entry whose index is given at the specified offset within the classfile.readNameAndTypeEntry(int pos) Returns the name-and-type entry whose index is given at the specified offset within the classfile.readPackageEntry(int pos) Returns the package entry whose index is given at the specified offset within the classfile.intreadS1(int p) Returns the signed byte at the specified offset within the classfile.intreadS2(int p) Returns the signed byte at the specified offset within the classfile.intreadU1(int p) Returns the unsigned byte at the specified offset within the classfile.intreadU2(int p) Returns the unsigned short at the specified offset within the classfile.readUtf8Entry(int pos) Returns the UTF8 entry whose index is given at the specified offset within the classfile.readUtf8EntryOrNull(int pos) Returns the UTF8 entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero.intsize()Returns the size of the constant pool.intskipAttributeHolder(int offset) Returns the offset following the block of attributes starting at the specified position.Returns the constant pool entry describing the name of the superclass, if any.Returns the constant pool entry describing the name of class.intReturns the offset into the classfile of thethis_classfield.utf8EntryByIndex(int index) Returns the UTF8 constant pool entry at the given index of the constant pool.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.glavo.classfile.constantpool.ConstantPool
iteratorMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
context
-
customAttributes
Description copied from interface:ClassReaderReturns the table of custom attribute mappers. This is derived from the processing optionClassFile.AttributeMapperOption.- Specified by:
customAttributesin interfaceClassReader- Returns:
- the table of custom attribute mappers
-
size
public int size()Description copied from interface:ConstantPoolReturns the size of the constant pool.- Specified by:
sizein interfaceConstantPool- Returns:
- the size of the constant pool
-
flags
public int flags()Description copied from interface:ClassReaderReturns the access flags for the class, as a bit mask .- Specified by:
flagsin interfaceClassReader- Returns:
- the access flags for the class, as a bit mask
-
thisClassEntry
Description copied from interface:ClassReaderReturns the constant pool entry describing the name of class.- Specified by:
thisClassEntryin interfaceClassReader- Returns:
- the constant pool entry describing the name of class
-
superclassEntry
Description copied from interface:ClassReaderReturns the constant pool entry describing the name of the superclass, if any.- Specified by:
superclassEntryin interfaceClassReader- Returns:
- the constant pool entry describing the name of the superclass, if any
-
thisClassPos
public int thisClassPos()Description copied from interface:ClassReaderReturns the offset into the classfile of thethis_classfield.- Specified by:
thisClassPosin interfaceClassReader- Returns:
- the offset into the classfile of the
this_classfield
-
classfileLength
public int classfileLength()Description copied from interface:ClassReaderReturns the length of the classfile, in bytes.- Specified by:
classfileLengthin interfaceClassReader- Returns:
- the length of the classfile, in bytes
-
bootstrapMethodCount
public int bootstrapMethodCount()Description copied from interface:ConstantPoolReturns the number of entries in the bootstrap method table.- Specified by:
bootstrapMethodCountin interfaceConstantPool- Returns:
- the number of entries in the bootstrap method table
-
bootstrapMethodEntry
Description copied from interface:ConstantPoolReturns theBootstrapMethodEntryat the specified index within the bootstrap method table.- Specified by:
bootstrapMethodEntryin interfaceConstantPool- Parameters:
index- the index within the bootstrap method table of the desired entry- Returns:
- the
BootstrapMethodEntryat the specified index within the bootstrap method table
-
readU1
public int readU1(int p) Description copied from interface:ClassReaderReturns the unsigned byte at the specified offset within the classfile.- Specified by:
readU1in interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the unsigned byte at the specified offset within the classfile
-
readU2
public int readU2(int p) Description copied from interface:ClassReaderReturns the unsigned short at the specified offset within the classfile.- Specified by:
readU2in interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the unsigned short at the specified offset within the classfile
-
readS1
public int readS1(int p) Description copied from interface:ClassReaderReturns the signed byte at the specified offset within the classfile.- Specified by:
readS1in interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the signed byte at the specified offset within the classfile
-
readS2
public int readS2(int p) Description copied from interface:ClassReaderReturns the signed byte at the specified offset within the classfile.- Specified by:
readS2in interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the signed byte at the specified offset within the classfile
-
readInt
public int readInt(int p) Description copied from interface:ClassReaderReturns the signed int at the specified offset within the classfile.- Specified by:
readIntin interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the signed int at the specified offset within the classfile
-
readLong
public long readLong(int p) Description copied from interface:ClassReaderReturns the signed long at the specified offset within the classfile.- Specified by:
readLongin interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the signed long at the specified offset within the classfile
-
readFloat
public float readFloat(int p) Description copied from interface:ClassReaderReturns the float value at the specified offset within the classfile.- Specified by:
readFloatin interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the float value at the specified offset within the classfile
-
readDouble
public double readDouble(int p) Description copied from interface:ClassReaderReturns the double value at the specified offset within the classfile.- Specified by:
readDoublein interfaceClassReader- Parameters:
p- the offset within the classfile- Returns:
- the double value at the specified offset within the classfile
-
readBytes
public byte[] readBytes(int p, int len) Description copied from interface:ClassReaderReturns a copy of the bytes at the specified range in the classfile.- Specified by:
readBytesin interfaceClassReader- Parameters:
p- the offset within the classfilelen- the length of the range- Returns:
- a copy of the bytes at the specified range in the classfile
-
copyBytesTo
Description copied from interface:ClassReaderCopy a range of bytes from the classfile to aBufWriter- Specified by:
copyBytesToin interfaceClassReader- Parameters:
buf- the BufWriterp- the offset within the classfilelen- the length of the range
-
entryByIndex
Description copied from interface:ConstantPoolReturns the entry at the specified index.- Specified by:
entryByIndexin interfaceConstantPool- Parameters:
index- the index within the pool of the desired entry- Returns:
- the entry at the specified index
-
utf8EntryByIndex
Description copied from interface:ClassReaderReturns the UTF8 constant pool entry at the given index of the constant pool. The given index must correspond to a valid constant pool index whose slot holds a UTF8 constant.- Specified by:
utf8EntryByIndexin interfaceClassReader- Parameters:
index- the index into the constant pool- Returns:
- the UTF8 constant pool entry at the given index of the constant pool
-
skipAttributeHolder
public int skipAttributeHolder(int offset) Description copied from interface:ClassReaderReturns the offset following the block of attributes starting at the specified position.- Specified by:
skipAttributeHolderin interfaceClassReader- Parameters:
offset- the offset into the classfile at which the attribute block starts- Returns:
- the offset following the block of attributes starting at the specified position
-
readEntry
Description copied from interface:ClassReaderReturns the constant pool entry whose index is given at the specified offset within the classfile.- Specified by:
readEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the constant pool entry whose index is given at the specified offset within the classfile
-
readEntry
Description copied from interface:ClassReaderReturns the constant pool entry of a given type whose index is given at the specified offset within the classfile.- Specified by:
readEntryin interfaceClassReader- Type Parameters:
T- the entry type- Parameters:
pos- the offset of the index within the classfilecls- the entry type- Returns:
- the constant pool entry of a given type whose index is given at the specified offset within the classfile
-
readEntryOrNull
Description copied from interface:ClassReaderReturns the constant pool entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero.- Specified by:
readEntryOrNullin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the constant pool entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero
-
readUtf8Entry
Description copied from interface:ClassReaderReturns the UTF8 entry whose index is given at the specified offset within the classfile.- Specified by:
readUtf8Entryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the UTF8 entry whose index is given at the specified offset within the classfile
-
readUtf8EntryOrNull
Description copied from interface:ClassReaderReturns the UTF8 entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero.- Specified by:
readUtf8EntryOrNullin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the UTF8 entry whose index is given at the specified offset within the classfile, or null if the index at the specified offset is zero
-
readModuleEntry
Description copied from interface:ClassReaderReturns the module entry whose index is given at the specified offset within the classfile.- Specified by:
readModuleEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the module entry whose index is given at the specified offset within the classfile
-
readPackageEntry
Description copied from interface:ClassReaderReturns the package entry whose index is given at the specified offset within the classfile.- Specified by:
readPackageEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the package entry whose index is given at the specified offset within the classfile
-
readClassEntry
Description copied from interface:ClassReaderReturns the class entry whose index is given at the specified offset within the classfile.- Specified by:
readClassEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the class entry whose index is given at the specified offset within the classfile
-
readNameAndTypeEntry
Description copied from interface:ClassReaderReturns the name-and-type entry whose index is given at the specified offset within the classfile.- Specified by:
readNameAndTypeEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the name-and-type entry whose index is given at the specified offset within the classfile
-
readMethodHandleEntry
Description copied from interface:ClassReaderReturns the method handle entry whose index is given at the specified offset within the classfile.- Specified by:
readMethodHandleEntryin interfaceClassReader- Parameters:
pos- the offset of the index within the classfile- Returns:
- the method handle entry whose index is given at the specified offset within the classfile
-
compare
Description copied from interface:ClassReaderCompare a range of bytes from the classfile to a range of bytes within aBufWriter.- Specified by:
comparein interfaceClassReader- Parameters:
bufWriter- the BufWriterbufWriterOffset- the offset within the BufWriterclassReaderOffset- the offset within the classfilelength- the length of the range- Returns:
- whether the two ranges were identical
-