Documentation ¶
Index ¶
- Constants
- type AttributeInfo
- type ClassFile
- func (self *ClassFile) AccessFlags() uint16
- func (self *ClassFile) ClassName() string
- func (self *ClassFile) ConstantPool() ConstantPool
- func (self *ClassFile) Fields() []*MemberInfo
- func (self *ClassFile) InterfaceNames() []string
- func (self *ClassFile) MajorVersion() uint16
- func (self *ClassFile) Methods() []*MemberInfo
- func (self *ClassFile) MinorVersion() uint16
- func (self *ClassFile) SuperClassName() string
- type ClassReader
- type CodeAttribute
- type ConstantClassInfo
- type ConstantDoubleInfo
- type ConstantFieldrefInfo
- type ConstantFloatInfo
- type ConstantInfo
- type ConstantIntegerInfo
- type ConstantInterfaceMethodrefInfo
- type ConstantInvokeDynamicInfo
- type ConstantLongInfo
- type ConstantMemberrefInfo
- type ConstantMethodHandleInfo
- type ConstantMethodTypeInfo
- type ConstantMethodrefInfo
- type ConstantNameAndTypeInfo
- type ConstantPool
- type ConstantStringInfo
- type ConstantUtf8Info
- type ConstantValueAttribute
- type DeprecatedAttribute
- type ExceptionTableEntry
- type ExceptionsAttribute
- type LineNumberTableAttribute
- type LineNumberTableEntry
- type LocalVariableTableAttribute
- type LocalVariableTableAttributeEntry
- type MarkerAttribute
- type MemberInfo
- type SourceFileAttribute
- type SyntheticAttribute
- type UnparsedAttribute
Constants ¶
View Source
const ( // 类或者接口的符号引用 CONSTANT_Class = 7 // 字段的符号引用 CONSTANT_Fieldref = 9 // 类中方法的符号引用 CONSTANT_Methodref = 10 // 接口中方法的符号引用 CONSTANT_InterfaceMethodref = 11 // 字符串类型字面量 CONSTANT_String = 8 // 整形字面量 CONSTANT_Integer = 3 // 浮点数字面量 CONSTANT_Float = 4 // 长整形字面量 CONSTANT_Long = 5 // 双精度浮点型字面量 CONSTANT_Double = 6 // 字段或者方法的部分符号引用 CONSTANT_NameAndType = 12 // UTF-8编码的字符串 CONSTANT_Utf8 = 1 // 方法句柄 CONSTANT_MethodHandle = 15 // 方法类型 CONSTANT_MethodType = 16 // 动态方法调用点 CONSTANT_InvokeDynamic = 18 )
tag 常量一般都由两个部分组成,tag和信息 tag用来区分常量类型
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttributeInfo ¶
type AttributeInfo interface {
// contains filtered or unexported methods
}
type ClassFile ¶
type ClassFile struct {
// contains filtered or unexported fields
}
class文件的映射类
func (*ClassFile) Fields ¶
func (self *ClassFile) Fields() []*MemberInfo
func (*ClassFile) InterfaceNames ¶
在二进制文件中,接口存储的是索引,指向了常量池中的位置
func (*ClassFile) Methods ¶
func (self *ClassFile) Methods() []*MemberInfo
func (*ClassFile) SuperClassName ¶
在二进制文件中,超类信息存储的是索引,指向了常量池中的位置
type ClassReader ¶
type ClassReader struct {
// contains filtered or unexported fields
}
类加载器,读取class文件的二进制数据到ClassReader中
type CodeAttribute ¶
type CodeAttribute struct {
// contains filtered or unexported fields
}
方法属性表
func (CodeAttribute) Code ¶ added in v1.5.0
func (self CodeAttribute) Code() []byte
func (CodeAttribute) MaxLocals ¶ added in v1.5.0
func (self CodeAttribute) MaxLocals() uint
局部变量表最大值
type ConstantClassInfo ¶
type ConstantClassInfo struct {
// contains filtered or unexported fields
}
常量池中类信息结构
func (*ConstantClassInfo) Name ¶
func (self *ConstantClassInfo) Name() string
type ConstantDoubleInfo ¶
type ConstantDoubleInfo struct {
// contains filtered or unexported fields
}
func (*ConstantDoubleInfo) Value ¶ added in v1.6.0
func (self *ConstantDoubleInfo) Value() float64
type ConstantFieldrefInfo ¶
type ConstantFieldrefInfo struct{ ConstantMemberrefInfo }
type ConstantFloatInfo ¶
type ConstantFloatInfo struct {
// contains filtered or unexported fields
}
常量池中的浮点数类型
func (*ConstantFloatInfo) Value ¶ added in v1.6.0
func (self *ConstantFloatInfo) Value() float32
type ConstantIntegerInfo ¶
type ConstantIntegerInfo struct {
// contains filtered or unexported fields
}
常量池中的整数类型
func (*ConstantIntegerInfo) Value ¶ added in v1.6.0
func (self *ConstantIntegerInfo) Value() int32
type ConstantInterfaceMethodrefInfo ¶
type ConstantInterfaceMethodrefInfo struct{ ConstantMemberrefInfo }
type ConstantInvokeDynamicInfo ¶
CONSTANT_InvokeDynamic_info { u1 tag; u2 bootstrap_method_attr_index; u2 name_and_type_index; }
type ConstantLongInfo ¶
type ConstantLongInfo struct {
// contains filtered or unexported fields
}
常量池中的长整形类型
func (*ConstantLongInfo) Value ¶ added in v1.6.0
func (self *ConstantLongInfo) Value() int64
type ConstantMemberrefInfo ¶
type ConstantMemberrefInfo struct {
// contains filtered or unexported fields
}
func (*ConstantMemberrefInfo) ClassName ¶
func (self *ConstantMemberrefInfo) ClassName() string
获取类名
func (*ConstantMemberrefInfo) NameAndDescriptor ¶
func (self *ConstantMemberrefInfo) NameAndDescriptor() (string, string)
获取描述符
type ConstantMethodHandleInfo ¶
CONSTANT_MethodHandle_info { u1 tag; u1 reference_kind; u2 reference_index; }
type ConstantMethodTypeInfo ¶
type ConstantMethodTypeInfo struct {
DescriptorIndex uint16
}
CONSTANT_MethodType_info { u1 tag; u2 descriptor_index; }
type ConstantMethodrefInfo ¶
type ConstantMethodrefInfo struct{ ConstantMemberrefInfo }
type ConstantNameAndTypeInfo ¶
type ConstantNameAndTypeInfo struct {
// contains filtered or unexported fields
}
type ConstantStringInfo ¶
type ConstantStringInfo struct {
// contains filtered or unexported fields
}
type ConstantUtf8Info ¶
type ConstantUtf8Info struct {
// contains filtered or unexported fields
}
符号引用的指针都会指向常量池中的索引 索引对应的数据用本utf8结构显示
type ConstantValueAttribute ¶
type ConstantValueAttribute struct {
// contains filtered or unexported fields
}
func (*ConstantValueAttribute) ConstantValueIndex ¶
func (self *ConstantValueAttribute) ConstantValueIndex() uint16
type DeprecatedAttribute ¶
type DeprecatedAttribute struct{ MarkerAttribute }
@Derecated 注解可以标示方法或者类已经过期
type ExceptionTableEntry ¶
type ExceptionTableEntry struct {
// contains filtered or unexported fields
}
受检查异常结构
type ExceptionsAttribute ¶
type ExceptionsAttribute struct {
// contains filtered or unexported fields
}
func (*ExceptionsAttribute) ExceptionIndexTable ¶
func (self *ExceptionsAttribute) ExceptionIndexTable() []uint16
type LineNumberTableAttribute ¶
type LineNumberTableAttribute struct {
// contains filtered or unexported fields
}
type LineNumberTableEntry ¶
type LineNumberTableEntry struct {
// contains filtered or unexported fields
}
type LocalVariableTableAttribute ¶
type LocalVariableTableAttribute struct {
// contains filtered or unexported fields
}
type LocalVariableTableAttributeEntry ¶
type LocalVariableTableAttributeEntry struct {
// contains filtered or unexported fields
}
type MarkerAttribute ¶
type MarkerAttribute struct{}
type MemberInfo ¶
type MemberInfo struct {
// contains filtered or unexported fields
}
字段表
func (*MemberInfo) AccessFlags ¶
func (self *MemberInfo) AccessFlags() uint16
func (*MemberInfo) CodeAttribute ¶ added in v1.5.0
func (self *MemberInfo) CodeAttribute() *CodeAttribute
获取方法的Code属性
func (*MemberInfo) ConstantValueAttribute ¶ added in v1.6.0
func (self *MemberInfo) ConstantValueAttribute() *ConstantValueAttribute
type SourceFileAttribute ¶
type SourceFileAttribute struct {
// contains filtered or unexported fields
}
source_file属性只会出现在classfile目录中
func (*SourceFileAttribute) FileName ¶
func (self *SourceFileAttribute) FileName() string
type UnparsedAttribute ¶
type UnparsedAttribute struct {
// contains filtered or unexported fields
}
Source Files ¶
- attr_code.go
- attr_constant_value.go
- attr_exception.go
- attr_invoke_dynamic.go
- attr_line_number_table.go
- attr_local_variable_table.go
- attr_markers.go
- attr_source_file.go
- attr_unparsed.go
- attribute_info.go
- class_file.go
- class_reader.go
- constant_info.go
- constant_pool.go
- cp_class.go
- cp_member_ref.go
- cp_name_and_type.go
- cp_numeric.go
- cp_string.go
- cp_utf8.go
- member_info.go
Click to show internal directories.
Click to hide internal directories.