serde

package
v1.3.11 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDeserializer

func NewDeserializer() *deserializer

NewDeserializer will create a new instance of the deserializer.

Types

type Deserializer

type Deserializer interface {
	CreateStruct(obj interface{}, buff []byte) (uint64, error)
	CreatePrimitiveDataType(obj interface{}, buff []byte) error
}

Deserializer defines the methods used to populate object fields based on the received byte array

type SourceBuffer

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

SourceBuffer encapsulates a bytes array

func NewSourceBuffer

func NewSourceBuffer(b []byte) *SourceBuffer

NewSourceBuffer returns a new SourceBuffer reading from b.

func (*SourceBuffer) BackUp

func (sb *SourceBuffer) BackUp(n uint64)

BackUp decrease offset position with n bytes

func (*SourceBuffer) Bytes

func (sb *SourceBuffer) Bytes() []byte

Bytes returns the entire array of bytes

func (*SourceBuffer) Len

func (sb *SourceBuffer) Len() uint64

Len returns the number of unused bytes

func (*SourceBuffer) NextBool

func (sb *SourceBuffer) NextBool() (bool, bool)

NextBool returns the next byte after offset as bool and increase offset position

func (*SourceBuffer) NextByte

func (sb *SourceBuffer) NextByte() (byte, bool)

NextByte returns the next byte after offset and increase offset position

func (*SourceBuffer) NextBytes

func (sb *SourceBuffer) NextBytes(n uint32) ([]byte, bool)

NextBytes returns the next n bytes after offset and increase offset position

func (*SourceBuffer) NextHash

func (sb *SourceBuffer) NextHash() (Uint256, bool)

NextHash returns the next 32 bytes after offset as Uint256 and increase offset position

func (*SourceBuffer) NextInt16

func (sb *SourceBuffer) NextInt16() (int16, bool)

NextInt16 returns the next 2 bytes after offset as int16 and increase offset position

func (*SourceBuffer) NextInt32

func (sb *SourceBuffer) NextInt32() (int32, bool)

NextInt32 returns the next 4 bytes after offset as int32 and increase offset position

func (*SourceBuffer) NextInt64

func (sb *SourceBuffer) NextInt64() (int64, bool)

NextInt64 returns the next 8 bytes after offset as int64 and increase offset position

func (*SourceBuffer) NextString

func (sb *SourceBuffer) NextString() (string, bool)

NextString uses the next 4 bytes to determine the number of bytes after the offset to be returned and returns them as string and increase offset position

func (*SourceBuffer) NextUint16

func (sb *SourceBuffer) NextUint16() (uint16, bool)

NextUint16 returns the next 2 bytes after offset as uint16 and increase offset position

func (*SourceBuffer) NextUint32

func (sb *SourceBuffer) NextUint32() (uint32, bool)

NextUint32 returns the next 4 bytes after offset as uint32 and increase offset position

func (*SourceBuffer) NextUint64

func (sb *SourceBuffer) NextUint64() (uint64, bool)

NextUint64 returns the next 8 bytes after offset as uint64 and increase offset position

func (*SourceBuffer) NextUint8

func (sb *SourceBuffer) NextUint8() (uint8, bool)

NextUint8 returns the next byte after offset as uint8 and increase offset position

func (*SourceBuffer) NextVarBytes

func (sb *SourceBuffer) NextVarBytes() ([]byte, bool)

NextVarBytes uses the next 4 bytes to determine the number of bytes after the offset to be returned and returns them and increase offset position

func (*SourceBuffer) OffBytes

func (sb *SourceBuffer) OffBytes() []byte

OffBytes returns unused bytes

func (*SourceBuffer) Pos

func (sb *SourceBuffer) Pos() uint64

Pos returns offset position

func (*SourceBuffer) Size

func (sb *SourceBuffer) Size() uint64

Size returns the length of the byte array

func (*SourceBuffer) Skip

func (sb *SourceBuffer) Skip(n uint64) bool

Skip increase offset position with n bytes

type Uint256

type Uint256 [uint256Size]byte

Uint256 is an alias for [32]byte

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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