class file reading support for AttributeMappers.
Supports reading arbitrary offsets within a class file and reading
data of various numeric types (e.g., u2, u4) in addition to
constant pool access.
All numeric values in the class file format are big endian.
Unless otherwise specified, all out-of-bounds access result in an IllegalArgumentException to indicate the class file data is
malformed. Since the class file data is arbitrary, users should
sanity-check the structural integrity of the data before attempting to
interpret the potentially malformed data.
AttributeMapper#readAttribute(AttributedElement, ClassReader, int)
| Modifier and Type | Method and Description |
|---|---|
| public int | Returns: the length of theclass file, in number of bytesReturns the length of the |
| public void | copyBytesTo(BufWriter
the BufWriter buf, int the offset within the offset, int class filethe length of the range len)Copy a range of bytes from the |
| public Function | Returns: the table of custom attribute mappersReturns the table of custom attribute mappers. |
| public int | Returns: the access flags for the class, as a bit maskReturns the access flags for the class, as a bit mask. |
| public byte[] | Returns: a copy of the bytes at the specified range in theclass
filethe offset within the offset, int class filethe length of the range len)Returns a copy of the bytes at the specified range in the |
| public double | Returns: the double value at the specified offset within theclass filethe offset within the offset)class fileReturns the double value at the specified offset within the |
| public PoolEntry | Returns: the constant pool entry whose index is given at the specified offset within theclass filethe offset of the index within the offset)class fileReturns the constant pool entry whose index is given at the specified
offset within the |
| public < the entry type T extends PoolEntry> T | Returns: the constant pool entry of a given type whose index is given at the specified offset within theclass filethe offset of the index within the offset, Class<T> class filethe entry type cls)Returns the constant pool entry of a given type whose index is given
at the specified offset within the |
| public PoolEntry | Returns: the constant pool entry whose index is given at the specified offset within theclass file, or null if the index at the
specified offset is zerothe offset of the index within the offset)class fileReturns the constant pool entry whose index is given at the specified
offset within the |
| public < the entry type T extends PoolEntry> T | Returns: the constant pool entry of a given type whose index is given at the specified offset within theclass file, or null if
the index at the specified offset is zerothe offset of the index within the offset, Class<T> class filethe entry type cls)Returns the constant pool entry of a given type whose index is given
at the specified offset within the |
| public float | Returns: the float value at the specified offset within theclass
filethe offset within the offset)class fileReturns the float value at the specified offset within the |
| public int | Returns: the signed int at the specified offset within theclass
filethe offset within the offset)class fileReturns the signed int at the specified offset within the |
| public long | Returns: the signed long at the specified offset within theclass
filethe offset within the offset)class fileReturns the signed long at the specified offset within the |
| public int | Returns: the signed byte at the specified offset within theclass
filethe offset within the offset)class fileReturns the signed byte at the specified offset within the |
| public int | Returns: the signed byte at the specified offset within theclass
filethe offset within the offset)class fileReturns the signed byte at the specified offset within the |
| public int | Returns: the unsigned byte at the specified offset within theclass filethe offset within the offset)class fileReturns the unsigned byte at the specified offset within the |
| public int | |
| public Optional | Returns: the constant pool entry describing the name of the superclass, if anyReturns the constant pool entry describing the name of the superclass, if any. |
| public ClassEntry | Returns: the constant pool entry describing the name of classReturns the constant pool entry describing the name of class. |
| classfileLength | back to summary |
|---|---|
| public int classfileLength() Returns the length of the
| |
| copyBytesTo | back to summary |
|---|---|
| public void copyBytesTo(BufWriter buf, int offset, int len) Copy a range of bytes from the | |
| customAttributes | back to summary |
|---|---|
| public Function Returns the table of custom attribute mappers. This is derived from
the processing option
| |
| flags | back to summary |
|---|---|
| public int flags() Returns the access flags for the class, as a bit mask.
| |
| readBytes | back to summary |
|---|---|
| public byte[] readBytes(int offset, int len) Returns a copy of the bytes at the specified range in the
| |
| readDouble | back to summary |
|---|---|
| public double readDouble(int offset) Returns the double value at the specified offset within the
In the conversions, all NaN values of the
| |
| readEntry | back to summary |
|---|---|
| public PoolEntry readEntry(int offset) Returns the constant pool entry whose index is given at the specified
offset within the API Note If only a particular type of entry is expected, use
| |
| readEntry | back to summary |
|---|---|
| public <T extends PoolEntry> T readEntry(int offset, Class<T> cls) Returns the constant pool entry of a given type whose index is given
at the specified offset within the
| |
| readEntryOrNull | back to summary |
|---|---|
| public PoolEntry readEntryOrNull(int offset) Returns the constant pool entry whose index is given at the specified
offset within the API Note If only a particular type of entry is expected, use
| |
| readEntryOrNull | back to summary |
|---|---|
| public <T extends PoolEntry> T readEntryOrNull(int offset, Class<T> cls) Returns the constant pool entry of a given type whose index is given
at the specified offset within the
| |
| readFloat | back to summary |
|---|---|
| public float readFloat(int offset) Returns the float value at the specified offset within the
In the conversions, all NaN values of the
| |
| readInt | back to summary |
|---|---|
| public int readInt(int offset) Returns the signed int at the specified offset within the
| |
| readLong | back to summary |
|---|---|
| public long readLong(int offset) Returns the signed long at the specified offset within the
| |
| readS1 | back to summary |
|---|---|
| public int readS1(int offset) Returns the signed byte at the specified offset within the
| |
| readS2 | back to summary |
|---|---|
| public int readS2(int offset) Returns the signed byte at the specified offset within the
| |
| readU1 | back to summary |
|---|---|
| public int readU1(int offset) Returns the unsigned byte at the specified offset within the
| |
| readU2 | back to summary |
|---|---|
| public int readU2(int offset) Returns the
| |
| superclassEntry | back to summary |
|---|---|
| public Optional Returns the constant pool entry describing the name of the superclass, if any.
| |
| thisClassEntry | back to summary |
|---|---|
| public ClassEntry thisClassEntry() Returns the constant pool entry describing the name of class.
| |