basic_encoding

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2025 License: AGPL-3.0, MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicIO

type BasicIO interface {
	Uint8(x *uint8)
	Int8(x *int8)
	Uint16(x *uint16)
	Int16(x *int16)
	Uint32(x *uint32)
	Int32(x *int32)
	Uint64(x *uint64)
	Int64(x *int64)

	Varint64(x *int64)
	Varuint64(x *uint64)
	Varint32(x *int32)
	Varuint32(x *uint32)
	Varint16(x *int16)
	Varuint16(x *uint16)

	Float32(x *float32)
	Float64(x *float64)
}

BasicIO represents a packet IO direction, but only used to read/write basic data type, which are number, float and double.

Implementations of this interface are Reader and Writer.

Reader reads data from the input stream into the pointers passed, whereas Writer writes the values the pointers point point to the output stream.

type BasicReader

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

BasicReader implements an IO that allows you read basic data to the underlying buffer.

Basic data are as follows: number, float and double.

func NewBasicReader

func NewBasicReader(r interface {
	io.Reader
	io.ByteReader
}) *BasicReader

NewReader creates a new BasicReader using io.ByteReader passed as underlying source to read bytes from.

func (*BasicReader) Float32

func (r *BasicReader) Float32(x *float32)

Float32 reads a big endian float32 from the underlying buffer.

func (*BasicReader) Float64

func (r *BasicReader) Float64(x *float64)

Float64 reads a big endian float64 from the underlying buffer.

func (*BasicReader) Int8

func (r *BasicReader) Int8(x *int8)

Int8 reads an int8 from the underlying buffer.

func (*BasicReader) Int16

func (r *BasicReader) Int16(x *int16)

Int16 reads a big endian int16 from the underlying buffer.

func (*BasicReader) Int32

func (r *BasicReader) Int32(x *int32)

Int32 reads a big endian int32 from the underlying buffer.

func (*BasicReader) Int64

func (r *BasicReader) Int64(x *int64)

Int64 reads a big endian int64 from the underlying buffer.

func (*BasicReader) Reader

func (r *BasicReader) Reader() interface {
	io.Reader
	io.ByteReader
}

Reader return the underlying reader which is r.r.

func (*BasicReader) Uint8

func (r *BasicReader) Uint8(x *uint8)

Uint8 reads a uint8 from the underlying buffer.

func (*BasicReader) Uint16

func (r *BasicReader) Uint16(x *uint16)

Uint16 reads a big endian uint16 from the underlying buffer.

func (*BasicReader) Uint32

func (r *BasicReader) Uint32(x *uint32)

Uint32 reads a big endian uint32 from the underlying buffer.

func (*BasicReader) Uint64

func (r *BasicReader) Uint64(x *uint64)

Uint64 reads a big endian uint64 from the underlying buffer.

func (*BasicReader) Varint16

func (r *BasicReader) Varint16(x *int16)

Varint16 reads up to 3 bytes from the underlying buffer into an int16.

func (*BasicReader) Varint32

func (r *BasicReader) Varint32(x *int32)

Varint32 reads up to 5 bytes from the underlying buffer into an int32.

func (*BasicReader) Varint64

func (r *BasicReader) Varint64(x *int64)

Varint64 reads up to 10 bytes from the underlying buffer into an int64.

func (*BasicReader) Varuint16

func (r *BasicReader) Varuint16(x *uint16)

Varuint16 reads up to 3 bytes from the underlying buffer into a uint16.

func (*BasicReader) Varuint32

func (r *BasicReader) Varuint32(x *uint32)

Varuint32 reads up to 5 bytes from the underlying buffer into a uint32.

func (*BasicReader) Varuint64

func (r *BasicReader) Varuint64(x *uint64)

Varuint64 reads up to 10 bytes from the underlying buffer into a uint64.

type BasicWriter

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

BasicWriter implements an IO that allows you write basic data to the underlying buffer.

Basic data are as follows: number, float and double.

func NewBasicWriter

func NewBasicWriter(w interface {
	io.Writer
	io.ByteWriter
}) *BasicWriter

NewReader creates a new BasicReader using io.ByteWriter passed as underlying source to read bytes from.

func (*BasicWriter) Float32

func (w *BasicWriter) Float32(x *float32)

Float32 writes a big endian float32 to the underlying buffer.

func (*BasicWriter) Float64

func (w *BasicWriter) Float64(x *float64)

Float64 writes a big endian float64 to the underlying buffer.

func (*BasicWriter) Int8

func (w *BasicWriter) Int8(x *int8)

Int8 writes an int8 to the underlying buffer.

func (*BasicWriter) Int16

func (w *BasicWriter) Int16(x *int16)

Int16 writes a big endian int16 to the underlying buffer.

func (*BasicWriter) Int32

func (w *BasicWriter) Int32(x *int32)

Int32 writes a big endian int32 to the underlying buffer.

func (*BasicWriter) Int64

func (w *BasicWriter) Int64(x *int64)

Int64 writes a big endian int64 to the underlying buffer.

func (*BasicWriter) Uint8

func (w *BasicWriter) Uint8(x *uint8)

Uint8 writes a uint8 to the underlying buffer.

func (*BasicWriter) Uint16

func (w *BasicWriter) Uint16(x *uint16)

Uint16 writes a big endian uint16 to the underlying buffer.

func (*BasicWriter) Uint32

func (w *BasicWriter) Uint32(x *uint32)

Uint32 writes a big endian uint32 to the underlying buffer.

func (*BasicWriter) Uint64

func (w *BasicWriter) Uint64(x *uint64)

Uint64 writes a big endian uint64 to the underlying buffer.

func (*BasicWriter) Varint16

func (w *BasicWriter) Varint16(x *int16)

Varint16 writes an int16 as 1-3 bytes to the underlying buffer.

func (*BasicWriter) Varint32

func (w *BasicWriter) Varint32(x *int32)

Varint32 writes an int32 as 1-5 bytes to the underlying buffer.

func (*BasicWriter) Varint64

func (w *BasicWriter) Varint64(x *int64)

Varint64 writes an int64 as 1-10 bytes to the underlying buffer.

func (*BasicWriter) Varuint16

func (w *BasicWriter) Varuint16(x *uint16)

Varuint16 writes a uint16 as 1-3 bytes to the underlying buffer.

func (*BasicWriter) Varuint32

func (w *BasicWriter) Varuint32(x *uint32)

Varuint32 writes a uint32 as 1-5 bytes to the underlying buffer.

func (*BasicWriter) Varuint64

func (w *BasicWriter) Varuint64(x *uint64)

Varuint64 writes a uint64 as 1-10 bytes to the underlying buffer.

func (*BasicWriter) Writer

func (w *BasicWriter) Writer() interface {
	io.Writer
	io.ByteWriter
}

Writer return the underlying writer which is w.w.

Jump to

Keyboard shortcuts

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