Documentation ¶
Index ¶
- Variables
- func NewSerializer() *binarySerializer
- type BinaryParser
- func (p *BinaryParser) HasMore() bool
- func (p *BinaryParser) Peek() (byte, error)
- func (p *BinaryParser) ReadByte() (byte, error)
- func (p *BinaryParser) ReadBytes(n int) ([]byte, error)
- func (p *BinaryParser) ReadField() (*definitions.FieldInstance, error)
- func (p *BinaryParser) ReadVariableLength() (int, error)
Constants ¶
This section is empty.
Variables ¶
var ErrLengthPrefixTooLong = errors.New("length of value must not exceed 918744 bytes of data")
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.