classfile

package
v0.0.0-...-b5cb9a8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

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
	CONSTANT_Utf8               = 1
	CONSTANT_MethodHandle       = 15
	CONSTANT_MethodType         = 16
	CONSTANT_InvokeDynamic      = 18
)

Constant pool tags

Variables

This section is empty.

Functions

This section is empty.

Types

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 BootstrapMethod struct {
	// contains filtered or unexported fields
}

type BootstrapMethodsAttribute

type BootstrapMethodsAttribute struct {
	// contains filtered or unexported fields
}
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 ClassFile

type ClassFile struct {
	// contains filtered or unexported fields
}
ClassFile {
    u4             magic;
    u2             minor_version;
    u2             major_version;
    u2             constant_pool_count;
    cp_info        constant_pool[constant_pool_count-1];
    u2             access_flags;
    u2             this_class;
    u2             super_class;
    u2             interfaces_count;
    u2             interfaces[interfaces_count];
    u2             fields_count;
    field_info     fields[fields_count];
    u2             methods_count;
    method_info    methods[methods_count];
    u2             attributes_count;
    attribute_info attributes[attributes_count];
}

func Parse

func Parse(classData []byte) (cf *ClassFile, err error)

func (*ClassFile) AccessFlags

func (self *ClassFile) AccessFlags() uint16

func (*ClassFile) ClassName

func (self *ClassFile) ClassName() string

func (*ClassFile) ConstantPool

func (self *ClassFile) ConstantPool() ConstantPool

func (*ClassFile) Fields

func (self *ClassFile) Fields() []*MemberInfo

func (*ClassFile) InterfaceNames

func (self *ClassFile) InterfaceNames() []string

func (*ClassFile) MajorVersion

func (self *ClassFile) MajorVersion() uint16

func (*ClassFile) Methods

func (self *ClassFile) Methods() []*MemberInfo

func (*ClassFile) MinorVersion

func (self *ClassFile) MinorVersion() uint16

func (*ClassFile) SuperClassName

func (self *ClassFile) SuperClassName() string

type ClassReader

type ClassReader struct {
	// contains filtered or unexported fields
}

type CodeAttribute

type CodeAttribute struct {
	// contains filtered or unexported fields
}
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 handler_pc;
        u2 catch_type;
    } exception_table[exception_table_length];
    u2 attributes_count;
    attribute_info attributes[attributes_count];
}

func (*CodeAttribute) Code

func (self *CodeAttribute) Code() []byte

func (*CodeAttribute) ExceptionTable

func (self *CodeAttribute) ExceptionTable() []*ExceptionTableEntry

func (*CodeAttribute) MaxLocals

func (self *CodeAttribute) MaxLocals() uint

func (*CodeAttribute) MaxStack

func (self *CodeAttribute) MaxStack() uint

type ConstantClassInfo

type ConstantClassInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_Class_info {
    u1 tag;
    u2 name_index;
}

func (*ConstantClassInfo) Name

func (self *ConstantClassInfo) Name() string

type ConstantDoubleInfo

type ConstantDoubleInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_Double_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}

func (*ConstantDoubleInfo) Value

func (self *ConstantDoubleInfo) Value() float64

type ConstantFieldrefInfo

type ConstantFieldrefInfo struct{ ConstantMemberrefInfo }
CONSTANT_Fieldref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}
CONSTANT_Methodref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}
CONSTANT_InterfaceMethodref_info {
    u1 tag;
    u2 class_index;
    u2 name_and_type_index;
}

type ConstantFloatInfo

type ConstantFloatInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_Float_info {
    u1 tag;
    u4 bytes;
}

func (*ConstantFloatInfo) Value

func (self *ConstantFloatInfo) Value() float32

type ConstantInfo

type ConstantInfo interface {
	// contains filtered or unexported methods
}
cp_info {
    u1 tag;
    u1 info[];
}

type ConstantIntegerInfo

type ConstantIntegerInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_Integer_info {
    u1 tag;
    u4 bytes;
}

func (*ConstantIntegerInfo) Value

func (self *ConstantIntegerInfo) Value() int32

type ConstantInterfaceMethodrefInfo

type ConstantInterfaceMethodrefInfo struct{ ConstantMemberrefInfo }

type ConstantInvokeDynamicInfo

type ConstantInvokeDynamicInfo struct {
	// contains filtered or unexported fields
}
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
}
CONSTANT_Long_info {
    u1 tag;
    u4 high_bytes;
    u4 low_bytes;
}

func (*ConstantLongInfo) Value

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

type ConstantMethodHandleInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_MethodHandle_info {
    u1 tag;
    u1 reference_kind;
    u2 reference_index;
}

type ConstantMethodTypeInfo

type ConstantMethodTypeInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_MethodType_info {
    u1 tag;
    u2 descriptor_index;
}

type ConstantMethodrefInfo

type ConstantMethodrefInfo struct{ ConstantMemberrefInfo }

type ConstantNameAndTypeInfo

type ConstantNameAndTypeInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_NameAndType_info {
    u1 tag;
    u2 name_index;
    u2 descriptor_index;
}

type ConstantPool

type ConstantPool []ConstantInfo

type ConstantStringInfo

type ConstantStringInfo struct {
	// contains filtered or unexported fields
}
CONSTANT_String_info {
    u1 tag;
    u2 string_index;
}

func (*ConstantStringInfo) String

func (self *ConstantStringInfo) String() string

type ConstantUtf8Info

type ConstantUtf8Info struct {
	// contains filtered or unexported fields
}
CONSTANT_Utf8_info {
    u1 tag;
    u2 length;
    u1 bytes[length];
}

func (*ConstantUtf8Info) Str

func (self *ConstantUtf8Info) Str() string

type ConstantValueAttribute

type ConstantValueAttribute struct {
	// contains filtered or unexported fields
}
ConstantValue_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 constantvalue_index;
}

func (*ConstantValueAttribute) ConstantValueIndex

func (self *ConstantValueAttribute) ConstantValueIndex() uint16

type DeprecatedAttribute

type DeprecatedAttribute struct {
	MarkerAttribute
}
Deprecated_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
}

type EnclosingMethodAttribute

type EnclosingMethodAttribute struct {
	// contains filtered or unexported fields
}
EnclosingMethod_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 class_index;
    u2 method_index;
}

func (*EnclosingMethodAttribute) ClassName

func (self *EnclosingMethodAttribute) ClassName() string

func (*EnclosingMethodAttribute) MethodNameAndDescriptor

func (self *EnclosingMethodAttribute) MethodNameAndDescriptor() (string, string)

type ExceptionTableEntry

type ExceptionTableEntry struct {
	// contains filtered or unexported fields
}

func (*ExceptionTableEntry) CatchType

func (self *ExceptionTableEntry) CatchType() uint16

func (*ExceptionTableEntry) EndPc

func (self *ExceptionTableEntry) EndPc() uint16

func (*ExceptionTableEntry) HandlerPc

func (self *ExceptionTableEntry) HandlerPc() uint16

func (*ExceptionTableEntry) StartPc

func (self *ExceptionTableEntry) StartPc() uint16

type ExceptionsAttribute

type ExceptionsAttribute struct {
	// contains filtered or unexported fields
}
Exceptions_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 number_of_exceptions;
    u2 exception_index_table[number_of_exceptions];
}

func (*ExceptionsAttribute) ExceptionIndexTable

func (self *ExceptionsAttribute) ExceptionIndexTable() []uint16

type InnerClassInfo

type InnerClassInfo struct {
	// contains filtered or unexported fields
}

type InnerClassesAttribute

type InnerClassesAttribute struct {
	// contains filtered or unexported fields
}
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 LineNumberTableAttribute

type LineNumberTableAttribute struct {
	// contains filtered or unexported fields
}
LineNumberTable_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 line_number_table_length;
    {   u2 start_pc;
        u2 line_number;
    } line_number_table[line_number_table_length];
}

func (*LineNumberTableAttribute) GetLineNumber

func (self *LineNumberTableAttribute) GetLineNumber(pc int) int

type LineNumberTableEntry

type LineNumberTableEntry struct {
	// contains filtered or unexported fields
}

type LocalVariableTableAttribute

type LocalVariableTableAttribute struct {
	// contains filtered or unexported fields
}
LocalVariableTable_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 local_variable_table_length;
    {   u2 start_pc;
        u2 length;
        u2 name_index;
        u2 descriptor_index;
        u2 index;
    } local_variable_table[local_variable_table_length];
}

type LocalVariableTableEntry

type LocalVariableTableEntry struct {
	// contains filtered or unexported fields
}

type LocalVariableTypeTableAttribute

type LocalVariableTypeTableAttribute struct {
	// contains filtered or unexported fields
}
LocalVariableTypeTable_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 local_variable_type_table_length;
    {   u2 start_pc;
        u2 length;
        u2 name_index;
        u2 signature_index;
        u2 index;
    } local_variable_type_table[local_variable_type_table_length];
}

type LocalVariableTypeTableEntry

type LocalVariableTypeTableEntry 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

func (self *MemberInfo) CodeAttribute() *CodeAttribute

func (*MemberInfo) Descriptor

func (self *MemberInfo) Descriptor() string

func (*MemberInfo) Name

func (self *MemberInfo) Name() string

type SignatureAttribute

type SignatureAttribute struct {
	// contains filtered or unexported fields
}
Signature_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 signature_index;
}

func (*SignatureAttribute) Signature

func (self *SignatureAttribute) Signature() string

type SourceFileAttribute

type SourceFileAttribute struct {
	// contains filtered or unexported fields
}
SourceFile_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
    u2 sourcefile_index;
}

func (*SourceFileAttribute) FileName

func (self *SourceFileAttribute) FileName() string

type SyntheticAttribute

type SyntheticAttribute struct {
	MarkerAttribute
}
Synthetic_attribute {
    u2 attribute_name_index;
    u4 attribute_length;
}

type UnparsedAttribute

type UnparsedAttribute struct {
	// contains filtered or unexported fields
}
attribute_info {
    u2 attribute_name_index;
    u4 attribute_length;
    u1 info[attribute_length];
}

func (*UnparsedAttribute) Info

func (self *UnparsedAttribute) Info() []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL