bytes

package
v0.0.0-...-34f5af7 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesFromStruct

func BytesFromStruct(data interface{}) ([]byte, int)

BytesFromStruct serializes the fields of a struct to an array of bytes in the order in which the fields are declared and returns total number of bytes converted. Panics if data is not a struct or pointer to struct, or if there was an error writing a field.

func ConvertToUtf16

func ConvertToUtf16(str string) []byte

ConvertToUtf16 converts a UTF-8 string to UTF-16 LE and return it as an array of bytes.

func StripPadding

func StripPadding(b []byte) []byte

StripPadding returns a slice of b without the trailing 0s.

func StructFromBytes

func StructFromBytes(data []byte, targetStruct interface{})

StructFromBytes populates the struct pointed to by targetStruct by reading in a stream of bytes and filling the values in sequential order.

Types

This section is empty.

Jump to

Keyboard shortcuts

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