binaryserializer

package
v0.0.0-...-12ac4f6 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: ISC Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Borrow

func Borrow() []byte

Borrow returns a byte slice from the free list with a length of 8. A new buffer is allocated if there are not any available on the free list.

func PutUint16

func PutUint16(w io.Writer, val uint16) error

PutUint16 serializes the provided uint16 using the given byte order into a buffer from the free list and writes the resulting two bytes to the given writer.

func PutUint32

func PutUint32(w io.Writer, val uint32) error

PutUint32 serializes the provided uint32 using the given byte order into a buffer from the free list and writes the resulting four bytes to the given writer.

func PutUint64

func PutUint64(w io.Writer, val uint64) error

PutUint64 serializes the provided uint64 using the given byte order into a buffer from the free list and writes the resulting eight bytes to the given writer.

func PutUint8

func PutUint8(w io.Writer, val uint8) error

PutUint8 copies the provided uint8 into a buffer from the free list and writes the resulting byte to the given writer.

func Return

func Return(buf []byte)

Return puts the provided byte slice back on the free list. The buffer MUST have been obtained via the Borrow function and therefore have a cap of 8.

func Uint16

func Uint16(r io.Reader) (uint16, error)

Uint16 reads two bytes from the provided reader using a buffer from the free list, converts it to a number using the provided byte order, and returns the resulting uint16.

func Uint32

func Uint32(r io.Reader) (uint32, error)

Uint32 reads four bytes from the provided reader using a buffer from the free list, converts it to a number using the provided byte order, and returns the resulting uint32.

func Uint64

func Uint64(r io.Reader) (uint64, error)

Uint64 reads eight bytes from the provided reader using a buffer from the free list, converts it to a number using the provided byte order, and returns the resulting uint64.

func Uint8

func Uint8(r io.Reader) (uint8, error)

Uint8 reads a single byte from the provided reader using a buffer from the free list and returns it as a uint8.

Types

This section is empty.

Jump to

Keyboard shortcuts

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