utils

package
v0.37.22 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLongData

func AppendLongData(input []byte, data []byte) []byte

AppendLongData appends data shorter than 32MB

func AppendShortData

func AppendShortData(input []byte, data []byte) []byte

AppendShortData appends data shorter than 16kB

func AppendUint16

func AppendUint16(input []byte, value uint16) []byte

AppendUint16 appends the value bytes to the input slice (big endian)

func AppendUint32

func AppendUint32(input []byte, value uint32) []byte

AppendUint32 appends the value bytes to the input slice (big endian)

func AppendUint64

func AppendUint64(input []byte, value uint64) []byte

AppendUint64 appends the value bytes to the input slice (big endian)

func AppendUint8

func AppendUint8(input []byte, value uint8) []byte

AppendUint8 appends the value byte to the input slice

func MaxUint16

func MaxUint16(a, b uint16) uint16

MaxUint16 returns the max value of two uint16

func ReadFromBuffer

func ReadFromBuffer(reader io.Reader, length int) ([]byte, error)

ReadFromBuffer reads 'length' bytes from the input

func ReadLongDataFromReader

func ReadLongDataFromReader(reader io.Reader) ([]byte, error)

ReadLongDataFromReader reads data shorter than 16kB from reader

func ReadShortData

func ReadShortData(input []byte) (data []byte, rest []byte, err error)

ReadShortData read data shorter than 16kB and return the rest of bytes

func ReadShortDataFromReader

func ReadShortDataFromReader(reader io.Reader) ([]byte, error)

ReadShortDataFromReader reads data shorter than 16kB from reader

func ReadSlice

func ReadSlice(input []byte, size int) (value []byte, rest []byte, err error)

ReadSlice reads `size` bytes from the input

func ReadUint16

func ReadUint16(input []byte) (value uint16, rest []byte, err error)

ReadUint16 reads a uint16 from the input and returns the rest

func ReadUint32

func ReadUint32(input []byte) (value uint32, rest []byte, err error)

ReadUint32 reads a uint32 from the input and returns the rest

func ReadUint64

func ReadUint64(input []byte) (value uint64, rest []byte, err error)

ReadUint64 reads a uint64 from the input and returns the rest

func ReadUint8

func ReadUint8(input []byte) (value uint8, rest []byte, err error)

ReadUint8 reads a uint8 from the input and returns the rest

func Uint16ToBinary

func Uint16ToBinary(integer uint16) []byte

Uint16ToBinary converst a uint16 to a byte slice (big endian)

func Uint64ToBinary

func Uint64ToBinary(integer uint64) []byte

Uint64ToBinary converst a uint64 to a byte slice (big endian)

Types

This section is empty.

Jump to

Keyboard shortcuts

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