classfile

package
Version: v0.0.0-...-258751f Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: Apache-2.0 Imports: 3 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
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeInfo

type AttributeInfo interface {
	ReadInfo(reader *ClassReader)
}

attribute_info {

u2 attribute_name_index;
u4 attribute_length;
u1 info[attribute_length];

}

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(bytes []byte) *ClassFile

func (*ClassFile) Methods

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

func (*ClassFile) Print

func (cf *ClassFile) Print()

type ClassReader

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

func NewClassReader

func NewClassReader(bytecode []byte) *ClassReader

func (*ClassReader) Length

func (cr *ClassReader) Length() int

func (*ClassReader) ReadBytes

func (cr *ClassReader) ReadBytes(len int) []byte

func (*ClassReader) ReadUint16

func (cr *ClassReader) ReadUint16() uint16

func (*ClassReader) ReadUint32

func (cr *ClassReader) ReadUint32() uint32

func (*ClassReader) ReadUint8

func (cr *ClassReader) ReadUint8() uint8

type CodeAttribute

type CodeAttribute struct {
	MaxStack   uint16
	MaxLocals  uint16
	Code       []uint8          //u4 code_length
	Exceptions []exceptionTable //u2 exception_table_length
	Attributes []AttributeInfo  //u2 attributes_count
	// 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) ReadInfo

func (this *CodeAttribute) ReadInfo(reader *ClassReader)

type ConstantClassInfo

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

func (*ConstantClassInfo) ReadInfo

func (this *ConstantClassInfo) ReadInfo(reader *ClassReader)

func (ConstantClassInfo) String

func (this ConstantClassInfo) String(constantPool ConstantPool) string

type ConstantDoubleInfo

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

func (*ConstantDoubleInfo) ReadInfo

func (this *ConstantDoubleInfo) ReadInfo(reader *ClassReader)

type ConstantFieldrefInfo

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

func (*ConstantFieldrefInfo) ReadInfo

func (this *ConstantFieldrefInfo) ReadInfo(reader *ClassReader)

func (ConstantFieldrefInfo) String

func (this ConstantFieldrefInfo) String(constantPool ConstantPool) string

type ConstantFloatInfo

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

func (*ConstantFloatInfo) ReadInfo

func (this *ConstantFloatInfo) ReadInfo(reader *ClassReader)

func (*ConstantFloatInfo) Value

func (this *ConstantFloatInfo) Value() float32

type ConstantIntegerInfo

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

func (*ConstantIntegerInfo) ReadInfo

func (this *ConstantIntegerInfo) ReadInfo(reader *ClassReader)

type ConstantInterfaceMethodrefInfo

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

func (*ConstantInterfaceMethodrefInfo) ReadInfo

func (this *ConstantInterfaceMethodrefInfo) ReadInfo(reader *ClassReader)

type ConstantInvokeDynamicInfo

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

func (*ConstantInvokeDynamicInfo) ReadInfo

func (this *ConstantInvokeDynamicInfo) ReadInfo(reader *ClassReader)

type ConstantLongInfo

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

func (*ConstantLongInfo) ReadInfo

func (this *ConstantLongInfo) ReadInfo(reader *ClassReader)

type ConstantMethodHandleInfo

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

func (*ConstantMethodHandleInfo) ReadInfo

func (this *ConstantMethodHandleInfo) ReadInfo(reader *ClassReader)

type ConstantMethodTypeInfo

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

func (*ConstantMethodTypeInfo) ReadInfo

func (this *ConstantMethodTypeInfo) ReadInfo(reader *ClassReader)

type ConstantMethodrefInfo

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

func (*ConstantMethodrefInfo) ClassName

func (self *ConstantMethodrefInfo) ClassName() string

func (*ConstantMethodrefInfo) ConstantPool

func (self *ConstantMethodrefInfo) ConstantPool() ConstantPool

func (*ConstantMethodrefInfo) NameAndDescriptor

func (self *ConstantMethodrefInfo) NameAndDescriptor() (string, string)

func (*ConstantMethodrefInfo) ReadInfo

func (this *ConstantMethodrefInfo) ReadInfo(reader *ClassReader)

func (*ConstantMethodrefInfo) String

func (this *ConstantMethodrefInfo) String() string

type ConstantNameAndTypeInfo

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

func (*ConstantNameAndTypeInfo) ReadInfo

func (this *ConstantNameAndTypeInfo) ReadInfo(reader *ClassReader)

func (ConstantNameAndTypeInfo) String

func (this ConstantNameAndTypeInfo) String(constantPool ConstantPool) string

type ConstantPool

type ConstantPool []ConstantPoolInfo

func (ConstantPool) GetConstantInfo

func (p ConstantPool) GetConstantInfo(index uint16) ConstantPoolInfo

type ConstantPoolInfo

type ConstantPoolInfo interface {
	ReadInfo(reader *ClassReader)
}

type ConstantStringInfo

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

func (*ConstantStringInfo) ReadInfo

func (this *ConstantStringInfo) ReadInfo(reader *ClassReader)

func (*ConstantStringInfo) String

func (this *ConstantStringInfo) String(constantPool ConstantPool) string

type ConstantUtf8Info

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

func (*ConstantUtf8Info) ReadInfo

func (this *ConstantUtf8Info) ReadInfo(reader *ClassReader)

func (ConstantUtf8Info) String

func (this ConstantUtf8Info) String() string

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) ReadInfo

func (this LineNumberTableAttribute) ReadInfo(reader *ClassReader)

type MemberInfo

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

field/method_info {

u2             access_flags;
u2             name_index;
u2             descriptor_index;
u2             attributes_count;
attribute_info attributes[attributes_count];

}

func (*MemberInfo) AccessFlags

func (self *MemberInfo) AccessFlags() uint16

func (*MemberInfo) CodeAttribute

func (m *MemberInfo) CodeAttribute() *CodeAttribute

func (*MemberInfo) ConstantPool

func (m *MemberInfo) ConstantPool() ConstantPool

func (*MemberInfo) Descriptor

func (m *MemberInfo) Descriptor() string

func (*MemberInfo) Name

func (m *MemberInfo) Name() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL