Documentation
¶
Index ¶
- Constants
- Variables
- func AddVerboseAndType(classObj *ClassObject, obj interface{})
- func Bcel2bytes(becl string) ([]byte, error)
- func Decompile(i []byte) (string, error)
- func GetLiteralFromCP(pool []ConstantInfo, index int) values.JavaValue
- func GetMap() ([]int, []int)
- func GetValueFromCP(pool []ConstantInfo, index int) values.JavaValue
- func Interface2Uint64(v interface{}) (uint64, error)
- func ParseBytesCode(dumper *ClassObjectDumper, codeAttr *CodeAttribute, id *utils.VariableId) ([]values.JavaValue, []statements.Statement, error)
- type AnnotationAttribute
- type AnnotationDefaultAttribute
- type AttributeInfo
- type BootstrapMethod
- type BootstrapMethodsAttribute
- type ClassObject
- func NewClassObject() *ClassObject
- func Parse(classData []byte) (cf *ClassObject, err error)
- func ParseFromBCEL(data string) (cf *ClassObject, err error)
- func ParseFromBase64(base string) (cf *ClassObject, err error)
- func ParseFromFile(path string) (cf *ClassObject, err error)
- func ParseFromJson(jsonData string) (cf *ClassObject, err error)
- func (this *ClassObject) Bcel() (string, error)
- func (this *ClassObject) Bytes() []byte
- func (this *ClassObject) Dump() (_ string, err error)
- func (this *ClassObject) FindConstStringFromPool(v string) *ConstantUtf8Info
- func (this *ClassObject) FindFields(v string) *MemberInfo
- func (this *ClassObject) FindMethods(v string) *MemberInfo
- func (this *ClassObject) GetClassName() string
- func (this *ClassObject) GetInterfacesName() []string
- func (this *ClassObject) GetSupperClassName() string
- func (this *ClassObject) Json() (string, error)
- func (this *ClassObject) SetClassName(name string) error
- func (this *ClassObject) SetMethodName(old, name string) error
- func (this *ClassObject) SetSourceFileName(name string) error
- func (this *ClassObject) ToBytesByCustomStringChar(charLength int) []byte
- type ClassObjectBuilder
- type ClassObjectDumper
- func (c *ClassObjectDumper) DumpAnnotation(anno *AnnotationAttribute) (string, error)
- func (c *ClassObjectDumper) DumpClass() (string, error)
- func (c *ClassObjectDumper) DumpFields() ([]dumpedFields, error)
- func (c *ClassObjectDumper) DumpMethod(methodName, desc string) (*dumpedMethods, error)
- func (c *ClassObjectDumper) DumpMethodWithInitialId(methodName, desc string, id *utils2.VariableId) (*dumpedMethods, error)
- func (c *ClassObjectDumper) DumpMethods() ([]*dumpedMethods, error)
- func (c *ClassObjectDumper) GetConstructorMethodName() string
- func (c *ClassObjectDumper) GetTabString() string
- func (c *ClassObjectDumper) Tab()
- func (c *ClassObjectDumper) TabNumber() int
- func (c *ClassObjectDumper) UnTab()
- type ClassParser
- 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 ConstantModuleInfo
- type ConstantNameAndTypeInfo
- type ConstantPackageInfo
- type ConstantPool
- func (c *ConstantPool) AddNewClassInfo(name string) int
- func (c *ConstantPool) AddNewMethodInfo(className, methodName, desc string) int
- func (c *ConstantPool) AddUtf8Info(s string) int
- func (c *ConstantPool) AppendConstantInfo(info ConstantInfo) int
- func (c *ConstantPool) GetClassName(index int) string
- func (c *ConstantPool) GetData() []ConstantInfo
- func (c *ConstantPool) GetUtf8(index int) *ConstantUtf8Info
- func (c *ConstantPool) IndexInfo(index int) ConstantInfo
- func (c *ConstantPool) ReplaceConstantInfo(index int, info ConstantInfo) string
- func (c *ConstantPool) SearchUtf8(s string) *ConstantUtf8Info
- func (c *ConstantPool) SearchUtf8Index(s string) int
- func (c *ConstantPool) SetData(data []ConstantInfo)
- type ConstantStringInfo
- type ConstantUtf8Info
- type ConstantValueAttribute
- type DeprecatedAttribute
- type ElementValuePairAttribute
- type EnumConstValue
- type ExceptionTableEntry
- type ExceptionsAttribute
- type FS
- type InnerClassInfo
- type InnerClassesAttribute
- type Instruction
- type JavaBufferWriter
- func (j *JavaBufferWriter) Bytes() []byte
- func (j *JavaBufferWriter) Write(v []byte) error
- func (j *JavaBufferWriter) Write1Byte(v interface{}) error
- func (j *JavaBufferWriter) Write2Byte(v interface{}) error
- func (j *JavaBufferWriter) Write4Byte(v interface{}) error
- func (j *JavaBufferWriter) Write8Byte(v interface{}) error
- func (j *JavaBufferWriter) WriteHex(v interface{}) error
- func (j *JavaBufferWriter) WriteLString(v string) error
- func (j *JavaBufferWriter) WriteString(v string) error
- type LineNumberTableAttribute
- type LineNumberTableEntry
- type MarkerAttribute
- type MemberInfo
- type RawJavaType
- type RuntimeInvisibleParameterAnnotationsAttribute
- type RuntimeVisibleAnnotationsAttribute
- type RuntimeVisibleParameterAnnotationsAttribute
- type RuntimeVisibleTypeAnnotationsAttribute
- type SignatureAttribute
- type SourceFileAttribute
- type StackType
- type SyntheticAttribute
- type UnparsedAttribute
- type VarMap
Constants ¶
const ( CONSTANT_Class = 7 CONSTANT_String = 8 CONSTANT_Fieldref = 9 CONSTANT_Methodref = 10 CONSTANT_InterfaceMethodref = 11 CONSTANT_Integer = 3 CONSTANT_Float = 4 CONSTANT_Long = 5 CONSTANT_Double = 6 CONSTANT_NameAndType = 12 CONSTANT_Utf8 = 1 CONSTANT_MethodHandle = 15 CONSTANT_MethodType = 16 CONSTANT_InvokeDynamic = 18 CONSTANT_Module = 19 CONSTANT_Package = 20 )
* See: https://docs.oracle.com/javase/specs/jvms/se9/html/jvms-4.html#jvms-4.4.11 * 常量数据结构如下
cp_info { u1 tag; -> 用来区分常量类型 u2 Info[]; }
const ( ClassObjectType = "ClassObject" MemberInfoType = "MemberInfo" ConstantInteger = "ConstantInteger" ConstantFloat = "ConstantFloat" ConstantLong = "ConstantLong" ConstantDouble = "ConstantDouble" ConstantUtf8 = "ConstantUtf8" ConstantString = "ConstantString" ConstantClass = "ConstantClass" ConstantFieldref = "ConstantFieldref" ConstantMethodref = "ConstantMethodref" ConstantInterfaceMethodref = "ConstantInterfaceMethodref" ConstantNameAndType = "ConstantNameAndType" ConstantMethodType = "ConstantMethodType" ConstantMethodHandle = "ConstantMethodHandle" ConstantInvokeDynamic = "ConstantInvokeDynamic" ConstantModule = "ConstantModule" ConstantPackage = "ConstantPackage" CodeAttributeType = "CodeAttribute" ConstantValueAttributeType = "ConstantValueAttribute" DeprecatedAttributeType = "DeprecatedAttribute" ExceptionsAttributeType = "ExceptionsAttribute" LineNumberTableAttributeType = "LineNumberTableAttribute" SourceFileAttributeType = "SourceFileAttribute" SyntheticAttributeType = "SyntheticAttribute" UnparsedAttributeType = "UnparsedAttribute" )
const (
StaticFlag = 0x0008
)
Variables ¶
var ConstantIntegerInfoIns = &ConstantIntegerInfo{}
var InstrInfos = map[int]*Instruction{}
var ValueTypeError = utils.Error("error value type")
Functions ¶
func AddVerboseAndType ¶
func AddVerboseAndType(classObj *ClassObject, obj interface{})
func Bcel2bytes ¶
func GetLiteralFromCP ¶
func GetLiteralFromCP(pool []ConstantInfo, index int) values.JavaValue
func GetValueFromCP ¶
func GetValueFromCP(pool []ConstantInfo, index int) values.JavaValue
func Interface2Uint64 ¶
func ParseBytesCode ¶
func ParseBytesCode(dumper *ClassObjectDumper, codeAttr *CodeAttribute, id *utils.VariableId) ([]values.JavaValue, []statements.Statement, error)
Types ¶
type AnnotationAttribute ¶
type AnnotationAttribute struct { TypeName string ElementValuePairs []*ElementValuePairAttribute }
func ParseAnnotation ¶
func ParseAnnotation(cp *ClassParser) *AnnotationAttribute
type AnnotationDefaultAttribute ¶
type AnnotationDefaultAttribute struct { }
AnnotationDefault_attribute { u2 attribute_name_index; u4 attribute_length; element_value default_value; }
type AttributeInfo ¶
type AttributeInfo interface {
// contains filtered or unexported methods
}
* 属性表,储存了方法的字节码等信息
attribute_info { u2 attribute_name_index; u4 attribute_length; u1 Info[attribute_length]; }
type BootstrapMethod ¶
type BootstrapMethodsAttribute ¶
type BootstrapMethodsAttribute struct { AttributeNameIndex uint16 AttributeLength uint32 NumBootstrapMethods uint16 BootstrapMethods []*BootstrapMethod }
BootstrapMethods_attribute { u2 attribute_name_index; u4 attribute_length; u2 num_bootstrap_methods; { u2 bootstrap_method_ref; u2 num_bootstrap_arguments; u2 bootstrap_arguments[num_bootstrap_arguments]; } bootstrap_methods[num_bootstrap_methods]; }
type ClassObject ¶
type ClassObject struct { //魔数 class的魔术 -> 0xCAFEBABE Type string Magic uint32 MinorVersion uint16 MajorVersion uint16 ConstantPool []ConstantInfo ConstantPoolManager *ConstantPool AccessFlags uint16 AccessFlagsVerbose []string AccessFlagsToCode string ThisClass uint16 ThisClassVerbose string SuperClass uint16 SuperClassVerbose string Interfaces []uint16 InterfacesVerbose []string Fields []*MemberInfo Methods []*MemberInfo Attributes []AttributeInfo }
func NewClassObject ¶
func NewClassObject() *ClassObject
func Parse ¶
func Parse(classData []byte) (cf *ClassObject, err error)
func ParseFromBCEL ¶
func ParseFromBCEL(data string) (cf *ClassObject, err error)
func ParseFromBase64 ¶
func ParseFromBase64(base string) (cf *ClassObject, err error)
func ParseFromFile ¶
func ParseFromFile(path string) (cf *ClassObject, err error)
func ParseFromJson ¶
func ParseFromJson(jsonData string) (cf *ClassObject, err error)
func (*ClassObject) Bcel ¶
func (this *ClassObject) Bcel() (string, error)
func (*ClassObject) Bytes ¶
func (this *ClassObject) Bytes() []byte
func (this *ClassObject) MarshalJSON() ([]byte, error) { js := CLassObjectJson{ Version: fmt.Sprintf("%d.%d", this.MajorVersion, this.MinorVersion), } return json.MarshalIndent(js, "", " ") }
func (*ClassObject) Dump ¶
func (this *ClassObject) Dump() (_ string, err error)
func (*ClassObject) FindConstStringFromPool ¶
func (this *ClassObject) FindConstStringFromPool(v string) *ConstantUtf8Info
查找
func (*ClassObject) FindFields ¶
func (this *ClassObject) FindFields(v string) *MemberInfo
func (*ClassObject) FindMethods ¶
func (this *ClassObject) FindMethods(v string) *MemberInfo
func (*ClassObject) GetInterfacesName ¶
func (this *ClassObject) GetInterfacesName() []string
func (*ClassObject) GetSupperClassName ¶
func (this *ClassObject) GetSupperClassName() string
func (*ClassObject) Json ¶
func (this *ClassObject) Json() (string, error)
func (*ClassObject) SetClassName ¶
func (this *ClassObject) SetClassName(name string) error
SetClassName 修改类名
func (*ClassObject) SetMethodName ¶
func (this *ClassObject) SetMethodName(old, name string) error
SetMethodName 设置函数名
func (*ClassObject) SetSourceFileName ¶
func (this *ClassObject) SetSourceFileName(name string) error
SetSourceFileName 设置文件名
func (*ClassObject) ToBytesByCustomStringChar ¶
func (this *ClassObject) ToBytesByCustomStringChar(charLength int) []byte
type ClassObjectBuilder ¶
type ClassObjectBuilder struct { Errors []error // contains filtered or unexported fields }
func NewClassObjectBuilder ¶
func NewClassObjectBuilder(c *ClassObject) *ClassObjectBuilder
func (*ClassObjectBuilder) GetErrors ¶
func (c *ClassObjectBuilder) GetErrors() []error
func (*ClassObjectBuilder) GetObject ¶
func (c *ClassObjectBuilder) GetObject() *ClassObject
func (*ClassObjectBuilder) NewError ¶
func (c *ClassObjectBuilder) NewError(msg string)
func (*ClassObjectBuilder) SetParam ¶
func (c *ClassObjectBuilder) SetParam(k, v string) *ClassObjectBuilder
func (*ClassObjectBuilder) SetValue ¶
func (c *ClassObjectBuilder) SetValue(old, new string) *ClassObjectBuilder
type ClassObjectDumper ¶
type ClassObjectDumper struct { FuncCtx *class_context.ClassContext ClassName string PackageName string CurrentMethod *MemberInfo ConstantPool []ConstantInfo MethodType *types.JavaFuncType // contains filtered or unexported fields }
func NewClassObjectDumper ¶
func NewClassObjectDumper(obj *ClassObject) *ClassObjectDumper
func (*ClassObjectDumper) DumpAnnotation ¶
func (c *ClassObjectDumper) DumpAnnotation(anno *AnnotationAttribute) (string, error)
func (*ClassObjectDumper) DumpClass ¶
func (c *ClassObjectDumper) DumpClass() (string, error)
func (*ClassObjectDumper) DumpFields ¶
func (c *ClassObjectDumper) DumpFields() ([]dumpedFields, error)
func (*ClassObjectDumper) DumpMethod ¶
func (c *ClassObjectDumper) DumpMethod(methodName, desc string) (*dumpedMethods, error)
func (*ClassObjectDumper) DumpMethodWithInitialId ¶
func (c *ClassObjectDumper) DumpMethodWithInitialId(methodName, desc string, id *utils2.VariableId) (*dumpedMethods, error)
func (*ClassObjectDumper) DumpMethods ¶
func (c *ClassObjectDumper) DumpMethods() ([]*dumpedMethods, error)
func (*ClassObjectDumper) GetConstructorMethodName ¶
func (c *ClassObjectDumper) GetConstructorMethodName() string
func (*ClassObjectDumper) GetTabString ¶
func (c *ClassObjectDumper) GetTabString() string
func (*ClassObjectDumper) Tab ¶
func (c *ClassObjectDumper) Tab()
func (*ClassObjectDumper) TabNumber ¶
func (c *ClassObjectDumper) TabNumber() int
func (*ClassObjectDumper) UnTab ¶
func (c *ClassObjectDumper) UnTab()
type ClassParser ¶
type ClassParser struct {
// contains filtered or unexported fields
}
func NewClassParser ¶
func NewClassParser(data []byte) *ClassParser
func (*ClassParser) Parse ¶
func (this *ClassParser) Parse() (*ClassObject, error)
type ClassReader ¶
type ClassReader struct {
// contains filtered or unexported fields
}
* jvm中定义了u1,u2,u4来表示1,2,4字节的 无 符号整数 相同类型的多条数据一般按表的形式存储在class文件中,由表头和表项构成,表头是u2或者u4整数。 假设表头为10,后面就紧跟着10个表项数据
func NewClassReader ¶
func NewClassReader(data []byte) *ClassReader
type CodeAttribute ¶
type CodeAttribute struct { Type string AttrLen uint32 MaxStack uint16 MaxLocals uint16 Code []byte ExceptionTable []*ExceptionTableEntry Attributes []AttributeInfo }
*
CODE_ATTRIBUTE { u2 attribute_name_index; u4 attribute_length; u2 max_stack; -> 操作数栈的最大深度 u2 max_locals; -> 局部变量表大小 u4 code_length; u1 Code[code_length]; u2 exception_table_length; { u2 start_pc; u2 end_pc; u2 handle_pc; u2 catch_type; } exception_table[exception_table_length]; u2 attributes_count; attribute_info Attributes[attributes_count] }
type ConstantClassInfo ¶
type ConstantClassInfo struct { Type string ConstantType string NameIndex uint16 NameIndexVerbose string }
*
CONSTANT_CLASS_INFO { u1 tag; u2 name_index; }
type ConstantDoubleInfo ¶
* 常量池中double 同样特殊 八字节
CONSTANT_DOUBLE_INFO { u1 tag; u4 high_bytes; u4 low_bytes; }
type ConstantFieldrefInfo ¶
type ConstantFieldrefInfo struct { Type string ConstantMemberrefInfo }
* 字段符号引用
CONSTANT_FIELDREF_INFO { u1 tag; u2 class_index; u2 name_and_type_index; }
type ConstantInfo ¶
type ConstantInfo interface {
// contains filtered or unexported methods
}
* constant info类型的接口
type ConstantIntegerInfo ¶
type ConstantIntegerInfo struct { Type string //实际上,比int小的boolean、byte、short、char也可以放在里面 Value int32 }
* 常量池中integer 四字节存储整数常量
CONSTANT_INTEGER_INFO { u1 tag; u4 bytes; }
type ConstantInterfaceMethodrefInfo ¶
type ConstantInterfaceMethodrefInfo struct { Type string ConstantMemberrefInfo }
* 接口方法符号引用
CONSTANT_INTERFACEMETHODREF_INFO { u1 tag; u2 class_index; u2 name_and_type_index; }
type ConstantInvokeDynamicInfo ¶
type ConstantInvokeDynamicInfo struct { Type string BootstrapMethodAttrIndex uint16 BootstrapMethodAttrIndexVerbose string NameAndTypeIndex uint16 NameAndTypeIndexVerbose string }
CONSTANT_InvokeDynamic_info { u1 tag; u2 bootstrap_method_attr_index; u2 name_and_type_index; }
type ConstantLongInfo ¶
* 常量池中long 特殊一些 八字节,分成高8字节和低8字节
CONSTANT_LONG_INFO { u1 tag; u4 high_bytes; u4 low_bytes; }
type ConstantMemberrefInfo ¶
type ConstantMemberrefInfo struct { ClassIndex uint16 ClassIndexVerbose string NameAndTypeIndex uint16 NameAndTypeIndexVerbose string }
* ConstantFieldrefInfo、ConstantMethodrefInfo、ConstantInterfaceMethodrefInfo 这三个结构体继承自ConstantMemberrefInfo Go语言没有“继承”的概念,而是通过结构体嵌套的方式实现的
type ConstantMethodHandleInfo ¶
type ConstantMethodHandleInfo struct { Type string ReferenceKind uint8 ReferenceKindVerbose string ReferenceIndex uint16 ReferenceIndexVerbose string }
CONSTANT_MethodHandle_info { u1 tag; u1 reference_kind; u2 reference_index; }
type ConstantMethodTypeInfo ¶
type ConstantMethodTypeInfo struct { Type string DescriptorIndex uint16 DescriptorIndexVerbose string }
CONSTANT_MethodType_info { u1 tag; u2 descriptor_index; }
type ConstantMethodrefInfo ¶
type ConstantMethodrefInfo struct { Type string ConstantMemberrefInfo }
* 普通(非接口)方法符号引用
CONSTANT_METHODREF_INFO { u1 tag; u2 class_index; u2 name_and_type_index; }
type ConstantModuleInfo ¶
type ConstantNameAndTypeInfo ¶
type ConstantNameAndTypeInfo struct { Type string //字段或方法名 指向一个CONSTANT_UTF8_INFO NameIndex uint16 NameIndexVerbose string //字段或方法的描述符 指向一个CONSTANT_UTF8_INFO DescriptorIndex uint16 DescriptorIndexVerbose string }
* 给出字段或方法的名称和描述符
CONSTANT_NAMEANDTYPE_INFO { u1 tag; u2 name_index; u2 descriptor_index }
type ConstantPackageInfo ¶
type ConstantPool ¶
type ConstantPool struct {
// contains filtered or unexported fields
}
func NewConstantPool ¶
func NewConstantPool() *ConstantPool
func NewConstantPoolWithConstant ¶
func NewConstantPoolWithConstant(data *[]ConstantInfo) *ConstantPool
func (*ConstantPool) AddNewClassInfo ¶
func (c *ConstantPool) AddNewClassInfo(name string) int
func (*ConstantPool) AddNewMethodInfo ¶
func (c *ConstantPool) AddNewMethodInfo(className, methodName, desc string) int
func (*ConstantPool) AddUtf8Info ¶
func (c *ConstantPool) AddUtf8Info(s string) int
func (*ConstantPool) AppendConstantInfo ¶
func (c *ConstantPool) AppendConstantInfo(info ConstantInfo) int
func (*ConstantPool) GetClassName ¶
func (c *ConstantPool) GetClassName(index int) string
func (*ConstantPool) GetData ¶
func (c *ConstantPool) GetData() []ConstantInfo
func (*ConstantPool) GetUtf8 ¶
func (c *ConstantPool) GetUtf8(index int) *ConstantUtf8Info
func (*ConstantPool) IndexInfo ¶
func (c *ConstantPool) IndexInfo(index int) ConstantInfo
func (*ConstantPool) ReplaceConstantInfo ¶
func (c *ConstantPool) ReplaceConstantInfo(index int, info ConstantInfo) string
func (*ConstantPool) SearchUtf8 ¶
func (c *ConstantPool) SearchUtf8(s string) *ConstantUtf8Info
func (*ConstantPool) SearchUtf8Index ¶
func (c *ConstantPool) SearchUtf8Index(s string) int
func (*ConstantPool) SetData ¶
func (c *ConstantPool) SetData(data []ConstantInfo)
type ConstantStringInfo ¶
* string info本身不存储字符串,只存了常量池索引,这个索引指向一个CONSTANT_UTF8_INFO。
CONSTANT_STRING_INFO { u1 tag; u2 string_index; }
type ConstantValueAttribute ¶
type ConstantValueAttribute struct { Type string AttrLen uint32 ConstantValueIndex uint16 ConstantValueIndexVerbose string }
*
CONSTANTVALUE_ATTRIBUTE { u2 attribute_name_index; u4 attribute_length; u2 constantvalue_index; }
type DeprecatedAttribute ¶
type DeprecatedAttribute struct { AttrLen uint32 MarkerAttribute }
* 用于支持@Deprecated注解
type ElementValuePairAttribute ¶
func ParseAnnotationElementValue ¶
func ParseAnnotationElementValue(cp *ClassParser) *ElementValuePairAttribute
func ParseAnnotationElementValuePair ¶
func ParseAnnotationElementValuePair(cp *ClassParser) *ElementValuePairAttribute
type EnumConstValue ¶
type ExceptionTableEntry ¶
* 异常表
type ExceptionsAttribute ¶
* 记录方法抛出的异常表
EXCEPTIONS_ATTRIBUTE { u2 attribute_name_index; u4 attribute_length; u2 number_of_exceptions; u2 exception_index_table[number_of_exceptions]; }
type InnerClassInfo ¶
type InnerClassesAttribute ¶
type InnerClassesAttribute struct { Type string AttrLen uint32 NumberOfClasses uint16 Classes []*InnerClassInfo }
InnerClasses_attribute { u2 attribute_name_index; u4 attribute_length; u2 number_of_classes; { u2 inner_class_info_index; u2 outer_class_info_index; u2 inner_name_index; u2 inner_class_access_flags; } classes[number_of_classes]; }
type Instruction ¶
type Instruction struct { Name string `json:"name"` OpCode int `json:"opcode"` Length int `json:"data_length"` StackPopped []*StackType `json:"stack_types"` StackPushed []*StackType `json:"stack_pushed"` RawJavaType *RawJavaType `json:"raw_java_type"` HandleName string `json:"handler"` NoThrow bool `json:"no_throw"` }
type JavaBufferWriter ¶
type JavaBufferWriter struct {
// contains filtered or unexported fields
}
func NewJavaBufferWrite ¶
func NewJavaBufferWrite() *JavaBufferWriter
func (*JavaBufferWriter) Bytes ¶
func (j *JavaBufferWriter) Bytes() []byte
func (*JavaBufferWriter) Write ¶
func (j *JavaBufferWriter) Write(v []byte) error
func (*JavaBufferWriter) Write1Byte ¶
func (j *JavaBufferWriter) Write1Byte(v interface{}) error
func (*JavaBufferWriter) Write2Byte ¶
func (j *JavaBufferWriter) Write2Byte(v interface{}) error
func (*JavaBufferWriter) Write4Byte ¶
func (j *JavaBufferWriter) Write4Byte(v interface{}) error
func (*JavaBufferWriter) Write8Byte ¶
func (j *JavaBufferWriter) Write8Byte(v interface{}) error
func (*JavaBufferWriter) WriteHex ¶
func (j *JavaBufferWriter) WriteHex(v interface{}) error
func (*JavaBufferWriter) WriteLString ¶
func (j *JavaBufferWriter) WriteLString(v string) error
func (*JavaBufferWriter) WriteString ¶
func (j *JavaBufferWriter) WriteString(v string) error
type LineNumberTableAttribute ¶
type LineNumberTableAttribute struct { Type string AttrLen uint32 LineNumberTable []*LineNumberTableEntry }
* 存放方法的行号信息,是调试信息
LINE_NUMBER_TABLE_ATTRIBUTE { u2 attribute_name_index; u4 attribute_length; u2 line_number_table_length; { u2 start_pc; u2 lint_number; } line_number_table[line_number_table_length]; }
type LineNumberTableEntry ¶
type MemberInfo ¶
type MemberInfo struct { Type string AccessFlags uint16 AccessFlagsVerbose []string NameIndex uint16 NameIndexVerbose string //描述符 DescriptorIndex uint16 DescriptorIndexVerbose string //属性表 Attributes []AttributeInfo }
* 字段/方法
type RawJavaType ¶
type RawJavaType struct { Name string `json:"name"` SuggestedVarName string `json:"suggestedVarName"` StackType *StackType `json:"stackType"` UsableType bool `json:"usableType"` BoxedName string `json:"boxedName"` IsNumber bool `json:"isNumber"` IsObject bool `json:"isObject"` IntMin int `json:"intMin"` IntMax int `json:"intMax"` }
type RuntimeInvisibleParameterAnnotationsAttribute ¶
type RuntimeInvisibleParameterAnnotationsAttribute struct { }
RuntimeInvisibleParameterAnnotations_attribute { u2 attribute_name_index; u4 attribute_length; u1 num_parameters; { u2 num_annotations; annotation annotations[num_annotations]; } parameter_annotations[num_parameters]; }
type RuntimeVisibleAnnotationsAttribute ¶
type RuntimeVisibleAnnotationsAttribute struct { Type string AttrLen uint32 Annotations []*AnnotationAttribute }
type RuntimeVisibleParameterAnnotationsAttribute ¶
type RuntimeVisibleParameterAnnotationsAttribute struct { }
RuntimeVisibleParameterAnnotations_attribute { u2 attribute_name_index; u4 attribute_length; u1 num_parameters; { u2 num_annotations; annotation annotations[num_annotations]; } parameter_annotations[num_parameters]; }
type RuntimeVisibleTypeAnnotationsAttribute ¶
type RuntimeVisibleTypeAnnotationsAttribute struct {
RuntimeVisibleAnnotationsAttribute
}
RuntimeVisibleTypeAnnotations_attribute { u2 attribute_name_index; u4 attribute_length; u2 num_annotations; type_annotation annotations[num_annotations]; }
type SignatureAttribute ¶
Signature_attribute { u2 attribute_name_index; u4 attribute_length; u2 signature_index; }
type SourceFileAttribute ¶
type SourceFileAttribute struct { Type string AttrLen uint32 SourceFileIndex uint16 SourceFileIndexVerbose string }
源文件属性
type SyntheticAttribute ¶
type SyntheticAttribute struct { AttrLen uint32 MarkerAttribute }
* 用来标记源文件中不存在的、由编译器生成的类成员,主要为了支持嵌套类(内部类)和嵌套接口
type UnparsedAttribute ¶
没解析的属性
Source Files
¶
- access_flags_verbose.go
- attribute_info.go
- class_object_builder.go
- class_parser.go
- class_reader.go
- code_analyser.go
- constant.go
- constant_pool.go
- cosntant_info.go
- cp_class.go
- cp_invoke_dynamic.go
- cp_member_ref.go
- cp_module_and_package.go
- cp_name_and_type.go
- cp_numeric.go
- cp_string.go
- cp_utf8.go
- dumper.go
- fs.go
- instr.go
- java_buffer_writer.go
- marshal.go
- member_info.go
- parse_class_object.go
- utils.go