blob

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package blob provides functions for writing and reading data to and from a byte sequence respectively. All operations are performed in little-endian order.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Plotter

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

Plotter is a wrapper over a byte slice that enables writing of various types of primitives in little-endian order.

func NewPlotter

func NewPlotter(data []byte) *Plotter

NewPlotter creates a new Plotter instance over the specified byte slice.

func (*Plotter) Data

func (p *Plotter) Data() []byte

Data returns the underlying byte slice.

func (*Plotter) Offset

func (p *Plotter) Offset() int

Offset returns the location of the write head.

func (*Plotter) PlotBytes added in v0.17.0

func (p *Plotter) PlotBytes(data []byte)

PlotBytes copies the specified data at the current offset and advances the offset with the length of the data.

func (*Plotter) PlotFloat16

func (p *Plotter) PlotFloat16(value float16.Float16)

PlotFloat16 sets a single float16 value at the current offset and advances the offset with 2 bytes.

func (*Plotter) PlotFloat32

func (p *Plotter) PlotFloat32(value float32)

PlotFloat32 sets a single float32 value at the current offset and advances the offset with 4 bytes.

func (*Plotter) PlotFloat64

func (p *Plotter) PlotFloat64(value float64)

PlotFloat64 sets a single float64 value at the current offset and advances the offset with 8 bytes.

func (*Plotter) PlotSPMat4

func (p *Plotter) PlotSPMat4(value sprec.Mat4)

PlotSPMat4 sets a sprec.Mat4 value at the current offset and advances the offset with 64 bytes.

func (*Plotter) PlotSPVec2

func (p *Plotter) PlotSPVec2(value sprec.Vec2)

PlotSPVec2 sets a sprec.Vec2 value at the current offset and advances the offset with 8 bytes.

func (*Plotter) PlotSPVec3

func (p *Plotter) PlotSPVec3(value sprec.Vec3)

PlotSPVec3 sets a sprec.Vec3 value at the current offset and advances the offset with 12 bytes.

func (*Plotter) PlotSPVec4

func (p *Plotter) PlotSPVec4(value sprec.Vec4)

PlotSPVec4 sets a sprec.Vec4 value at the current offset and advances the offset with 16 bytes.

func (*Plotter) PlotUint16

func (p *Plotter) PlotUint16(value uint16)

PlotUint16 sets a single uint16 value at the current offset and advances the offset with 2 bytes.

func (*Plotter) PlotUint32

func (p *Plotter) PlotUint32(value uint32)

PlotUint32 sets a single uint32 value at the current offset and advances the offset with 4 bytes.

func (*Plotter) PlotUint64

func (p *Plotter) PlotUint64(value uint64)

PlotUint64 sets a single uint64 value at the current offset and advances the offset with 8 bytes.

func (*Plotter) PlotUint8

func (p *Plotter) PlotUint8(value byte)

PlotUint8 sets a single byte at the current offset and advances the offset with 1 byte.

func (*Plotter) Rewind

func (p *Plotter) Rewind()

Rewind moves the write head back to the start of the slice.

func (*Plotter) Seek

func (p *Plotter) Seek(offset int)

Seek changes the location of the write head.

func (*Plotter) Skip

func (p *Plotter) Skip(offset int)

Skip moves the offset by the specified amount.

type Scanner

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

Scanner is a wrapper over a byte slice that enables writing of various types of primitives.

func NewScanner

func NewScanner(data []byte) *Scanner

NewScanner creates a new Scanner instance over the specified byte slice.

func (*Scanner) Data

func (s *Scanner) Data() []byte

Data returns the underlying byte slice.

func (*Scanner) Offset

func (s *Scanner) Offset() int

Offset returns the location of the write head.

func (*Scanner) Rewind

func (s *Scanner) Rewind()

Rewind moves the write head back to the start of the slice.

func (*Scanner) ScanFloat32

func (s *Scanner) ScanFloat32() float32

ScanFloat32 reads a single float32 value from the current offset and advances the offset with four bytes.

func (*Scanner) ScanSPMat4

func (s *Scanner) ScanSPMat4() sprec.Mat4

ScanSPMat4 reads a sprec.Mat4 value from the current offset and advances the offset with 64 bytes.

func (*Scanner) ScanSPVec2

func (s *Scanner) ScanSPVec2() sprec.Vec2

ScanSPVec2 reads a sprec.Vec2 value from the current offset and advances the offset with 8 bytes.

func (*Scanner) ScanSPVec3

func (s *Scanner) ScanSPVec3() sprec.Vec3

ScanSPVec3 reads a sprec.Vec3 value from the current offset and advances the offset with 12 bytes.

func (*Scanner) ScanSPVec4

func (s *Scanner) ScanSPVec4() sprec.Vec4

ScanSPVec4 reads a sprec.Vec4 value from the current offset and advances the offset with 12 bytes.

func (*Scanner) ScanUint16

func (s *Scanner) ScanUint16() uint16

ScanUint16 reads a single byte from the specified offset and then advances the offset with 2 bytes.

func (*Scanner) ScanUint32

func (s *Scanner) ScanUint32() uint32

ScanUint32 reads a single byte from the specified offset and then advances the offset with 4 bytes.

func (*Scanner) ScanUint8

func (s *Scanner) ScanUint8() byte

ScanUint8 reads a single byte from the specified offset and then advances the offset with 1 byte.

func (*Scanner) Seek

func (s *Scanner) Seek(offset int)

Seek changes the location of the write head.

func (*Scanner) Skip

func (s *Scanner) Skip(offset int)

Skip moves the offset by the specified amount.

Jump to

Keyboard shortcuts

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