gojav

package module
v0.0.0-...-909ec0a Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2022 License: MIT Imports: 5 Imported by: 0

README

gojav

ed d

Documentation

Index

Constants

View Source
const (
	CodeAttr          = "Code"
	InnerClassesAttr  = "InnerClasses"
	ConstantValueAttr = "ConstantValue"
	SignatureAttr     = "Signature"
)
View Source
const (
	ClassConstant              uint8 = 7
	FieldrefConstant                 = 9
	MethodrefConstant                = 10
	InterfaceMethodrefConstant       = 11
	StringConstant                   = 8
	IntegerConstant                  = 3
	FloatConstant                    = 4
	LongConstant                     = 5
	DoubleConstant                   = 6
	NameAndTypeConstant              = 12
	Utf8Constant                     = 1
	MethodHandleConstant             = 15
	MethodTypeConstant               = 16
	InvokeDynamicConstant            = 18
)
View Source
const (
	PublicFieldACC    AccessFlag = 0x0001
	PrivateFieldACC              = 0x0002
	ProtectedFieldACC            = 0x0004
	StaticFieldACC               = 0x0004
	FinalFieldACC                = 0x0008
	VolatileFieldACC             = 0x0010
	TransientFieldACC            = 0x0040
	SyntheticFieldACC            = 0x1000
	EnumFieldACC                 = 0x4000
)
View Source
const (
	PublicMethodACC       AccessFlag = 0x0001
	PrivateMethodACC                 = 0x0002
	ProtectedMethodACC               = 0x0004
	StaticMethodACC                  = 0x0008
	FinalMethodACC                   = 0x0010
	SynchronizedMethodACC            = 0x0020
	BridgeMethodACC                  = 0x0040
	VarargsMethodACC                 = 0x0080
	NativeMethodACC                  = 0x0100
	AbstractMethodACC                = 0x0400
	StrictMethodACC                  = 0x0800
	SyntheticMethodACC               = 0x1000
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessFlag

type AccessFlag uint16

type Attribute

type Attribute uint8

type AttributeInfo

type AttributeInfo struct {
	NameIndex uint16
	Length    uint32
	Info      []uint8
}

type Attributes

type Attributes struct {
	Size       uint16
	Attributes []any
}

type ClassFile

type ClassFile struct {
	Magic        uint32
	MinorVersion uint16
	MajorVersion uint16
	ConstantPool *ConstantPool
	AccessFlags  uint16
	ThisClass    uint16
	SuperClass   uint16
	Interfaces   *Interfaces

	FieldCount     uint16
	Fields         []*FieldInfo
	MethodCount    uint16
	Methods        []MethodInfo
	AttributeCount uint16
	Attributes     []AttributeInfo
}

func ParseClassFile

func ParseClassFile(r Reader) (*ClassFile, error)

type CodeAttribute

type CodeAttribute struct {
	LocalVariables uint16
	CodeLength     uint32
	CodeFullLength uint16
	Attributes     *Attributes
}

type ConstantPool

type ConstantPool struct {
	Size uint16
	Pool []*ConstantPoolEntry
}

func (*ConstantPool) GetLinkConstant

func (c *ConstantPool) GetLinkConstant(index uint16) (*RLinkConstant, error)

func (*ConstantPool) GetStringEntry

func (c *ConstantPool) GetStringEntry(index uint16) (string, error)

type ConstantPoolEntry

type ConstantPoolEntry struct {
	Tag   uint8
	Value interface{}
}

type ConstantValueAttribute

type ConstantValueAttribute struct {
	Index uint16
}

type DoubleInfo

type DoubleInfo struct {
	Tag       uint8
	HighBytes uint32
	LowBytes  uint32
}

type FieldInfo

type FieldInfo struct {
	AccessFlags     uint16 // See AccessFlag
	NameIndex       uint16
	DescriptorIndex uint16

	AttributeCount uint16
	Attributes     []AttributeInfo
}

type FloatInfo

type FloatInfo struct {
	Tag   uint8
	Bytes uint32
}

type IndexConstant

type IndexConstant struct {
	Tag   uint8
	Index uint16
}

func (*IndexConstant) Resolve

func (l *IndexConstant) Resolve(pool *ConstantPool) (*RIndexConstant, error)

type InnerClassesAttribute

type InnerClassesAttribute struct {
	Size    uint16
	Entries []InnerClassesAttributeEntry
}

type InnerClassesAttributeEntry

type InnerClassesAttributeEntry struct {
	InnerNameIndex  uint16
	OuterNameIndex  uint16
	SimpleNameIndex uint16
	AccessFlags     uint16

	InnerName  string
	OuterName  string
	SimpleName string
}

type Interfaces

type Interfaces struct {
	Size    uint16
	Indexes []uint16
	Names   []string
}

type LinkConstant

type LinkConstant struct {
	Tag              uint8
	Index            uint16
	NameAndTypeIndex uint16
}

func (*LinkConstant) Resolve

func (l *LinkConstant) Resolve(pool *ConstantPool) (*RLinkConstant, error)

type LongInfo

type LongInfo struct {
	Tag       uint8
	HighBytes uint32
	LowBytes  uint32
}

type MethodHandleInfo

type MethodHandleInfo struct {
	Tag            uint8
	ReferenceKind  uint8
	ReferenceIndex uint16
}

type MethodInfo

type MethodInfo struct {
	AccessFlags     uint16
	NameIndex       uint16
	DescriptorIndex uint16

	AttributeCount uint16
	Attributes     []AttributeInfo
}

type RIndexConstant

type RIndexConstant struct {
	Tag   uint8
	Value string
}

type RLinkConstant

type RLinkConstant struct {
	ClassName   string
	ElementName string
	Descriptor  string
}

type Reader

type Reader struct {
	io.Reader
}

func (*Reader) Discard

func (r *Reader) Discard(length int64)

func (Reader) ReadAttributes

func (r Reader) ReadAttributes(pool *ConstantPool) (*Attributes, error)

func (Reader) ReadCodeAttribute

func (r Reader) ReadCodeAttribute(pool *ConstantPool) (*CodeAttribute, error)

func (Reader) ReadConstantPool

func (r Reader) ReadConstantPool() (*ConstantPool, error)

func (Reader) ReadConstantValueAttribute

func (r Reader) ReadConstantValueAttribute() (*ConstantValueAttribute, error)

func (*Reader) ReadDouble

func (r *Reader) ReadDouble() (float64, error)

func (*Reader) ReadDoubleTo

func (r *Reader) ReadDoubleTo(out *float64) error

func (Reader) ReadField

func (r Reader) ReadField(pool *ConstantPool) (*FieldInfo, error)

func (*Reader) ReadFloat

func (r *Reader) ReadFloat() (float32, error)

func (*Reader) ReadFloatTo

func (r *Reader) ReadFloatTo(out *float32) error

func (Reader) ReadInnerClassesAttribute

func (r Reader) ReadInnerClassesAttribute(pool *ConstantPool) (*InnerClassesAttribute, error)

func (Reader) ReadInterfaces

func (r Reader) ReadInterfaces(pool *ConstantPool) (*Interfaces, error)

func (*Reader) ReadLong

func (r *Reader) ReadLong() (int64, error)

func (*Reader) ReadLongTo

func (r *Reader) ReadLongTo(out *int64) error

func (Reader) ReadSignatureAttribute

func (r Reader) ReadSignatureAttribute(pool *ConstantPool) (*SignatureAttribute, error)

func (*Reader) ReadU1

func (r *Reader) ReadU1() (uint8, error)

func (*Reader) ReadU1To

func (r *Reader) ReadU1To(out *uint8) error

func (*Reader) ReadU2

func (r *Reader) ReadU2() (uint16, error)

func (*Reader) ReadU2To

func (r *Reader) ReadU2To(out *uint16) error

func (*Reader) ReadU4

func (r *Reader) ReadU4() (uint32, error)

func (*Reader) ReadU4To

func (r *Reader) ReadU4To(out *uint32) error

func (*Reader) ReadUTF8

func (r *Reader) ReadUTF8() (string, error)

type SignatureAttribute

type SignatureAttribute struct {
	Signature string
}

type Utf8Info

type Utf8Info struct {
	Tag    uint8
	Length uint16
	Bytes  []uint8
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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