java

package
v0.0.0-...-af1a5b7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamMagic   = "\xAC\xED"
	StreamVersion = int16(5)
)
View Source
const (
	ScWriteMethod    = 0x01
	ScBlockData      = 0x08
	ScSerializable   = 0x02
	ScExternalizable = 0x04
	ScEnum           = 0x10
)

Variables

View Source
var ErrNoSuchClass = errors.New("no such class in object")
View Source
var ErrNoSuchField = errors.New("no such field in object")
View Source
var ErrNotSupported = errors.New("not supported")

Functions

func AddPackagePrefixes

func AddPackagePrefixes(prefixes ...string)

func AllowInt8ToByteCoercion

func AllowInt8ToByteCoercion()

func PreventInt8ToByteCoercion

func PreventInt8ToByteCoercion()

func SetPackagePrefixes

func SetPackagePrefixes(prefixes ...string)

func Unmarshal

func Unmarshal(data []byte, v any) error

func UnmarshalReader

func UnmarshalReader(r io.Reader, v any) error

Types

type Annotation

type Annotation any

type Array

type Array struct {
	ClassDesc *Class
	Values    []Value
}

func (Array) Get

func (a Array) Get(index int) Value

func (Array) ItemType

func (a Array) ItemType() (TypeCode, string)

func (Array) Length

func (a Array) Length() int

type Class

type Class struct {
	ClassName        string
	SerialVersionUID SerialVersionUID
	Info             ClassDescInfo
}

type ClassData

type ClassData map[string]Value

type ClassDescFlags

type ClassDescFlags byte

func (ClassDescFlags) HasWriteMethod

func (f ClassDescFlags) HasWriteMethod() bool

func (ClassDescFlags) IsSerializable

func (f ClassDescFlags) IsSerializable() bool

type ClassDescInfo

type ClassDescInfo struct {
	Flags           ClassDescFlags
	Fields          []Field
	ClassAnnotation []Annotation
	SuperClassDesc  *Class
}

type Content

type Content any

type Decoder

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

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode() (Content, error)

Decode parses the first element of a stream of serialized Java objects https://docs.oracle.com/javase/6/docs/platform/serialization/spec/protocol.html

func (*Decoder) DecodeAll

func (d *Decoder) DecodeAll(limit int) ([]Content, error)

DecodeAll parses serialized Java objects https://docs.oracle.com/javase/6/docs/platform/serialization/spec/protocol.html

func (*Decoder) Reset

func (d *Decoder) Reset()

type Enum

type Enum struct {
	ClassDesc    *Class
	ConstantName string
}

type Field

type Field struct {
	TypeCode  TypeCode
	FieldName string
	ClassName string
}

type InvalidUnmarshalError

type InvalidUnmarshalError struct {
	Type reflect.Type
}

An InvalidUnmarshalError describes an invalid argument passed to Unmarshal. (The argument to Unmarshal must be a non-nil pointer.)

func (*InvalidUnmarshalError) Error

func (e *InvalidUnmarshalError) Error() string

type Object

type Object struct {
	ClassDesc *Class
	ClassData map[string]ClassData
}

type SerialVersionUID

type SerialVersionUID int64

type TypeCode

type TypeCode byte
const (
	TypeByte    TypeCode = 'B'
	TypeChar    TypeCode = 'C'
	TypeDouble  TypeCode = 'D'
	TypeFloat   TypeCode = 'F'
	TypeInteger TypeCode = 'I'
	TypeLong    TypeCode = 'J'
	TypeShort   TypeCode = 'S'
	TypeBoolean TypeCode = 'Z'
	TypeArray   TypeCode = '['
	TypeObject  TypeCode = 'L'
)

func (TypeCode) IsObject

func (t TypeCode) IsObject() bool

func (TypeCode) IsPrimitive

func (t TypeCode) IsPrimitive() bool

type Value

type Value any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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