serdes

package
v0.0.0-...-cb7fc92 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrLengthPrefixTooLong = errors.New("length of value must not exceed 918744 bytes of data")
View Source
var (
	ErrParserOutOfBound error = errors.New("parser out of bounds")
)

Functions

func NewSerializer

func NewSerializer() *binarySerializer

Types

type BinaryParser

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

func NewBinaryParser

func NewBinaryParser(d []byte) *BinaryParser

NewBinaryParser returns a new BinaryParser initialized with the given data.

func (*BinaryParser) HasMore

func (p *BinaryParser) HasMore() bool

HasMore returns true if there is more data to read, and false otherwise.

func (*BinaryParser) Peek

func (p *BinaryParser) Peek() (byte, error)

Peek returns the next byte in the data without advancing the read cursor. It returns an error if no more data is available.

func (*BinaryParser) ReadByte

func (p *BinaryParser) ReadByte() (byte, error)

ReadByte reads the next byte in the data. It returns an error if no more data is available.

func (*BinaryParser) ReadBytes

func (p *BinaryParser) ReadBytes(n int) ([]byte, error)

ReadBytes reads the next n bytes in the data. It returns an error if fewer than n bytes are available.

func (*BinaryParser) ReadField

func (p *BinaryParser) ReadField() (*definitions.FieldInstance, error)

ReadField reads the next field in the data. It reads the field's header, fetches the field's name based on its header, and then gets the FieldInstance for that field name.

func (*BinaryParser) ReadVariableLength

func (p *BinaryParser) ReadVariableLength() (int, error)

ReadVariableLength reads a variable-length field from the binary data and returns the length as an integer. The length is determined by 1 to 3 bytes length prefix according to XRPL documentation.

Jump to

Keyboard shortcuts

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