binaryutil

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: Apache-2.0 Imports: 3 Imported by: 44

Documentation

Overview

Package binaryutil contains convenience wrappers around encoding/binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Int32

func Int32(b []byte) int32

func PutInt32

func PutInt32(v int32) []byte

func PutString

func PutString(s string) []byte

func String

func String(b []byte) string

Types

type ByteOrder

type ByteOrder interface {
	PutUint16(v uint16) []byte
	PutUint32(v uint32) []byte
	PutUint64(v uint64) []byte
	Uint16(b []byte) uint16
	Uint32(b []byte) uint32
	Uint64(b []byte) uint64
}

ByteOrder is like binary.ByteOrder, but allocates memory and returns byte slices, for convenience.

var BigEndian ByteOrder = &bigEndian{}

BigEndian is like binary.BigEndian, but allocates memory and returns byte slices, for convenience.

var NativeEndian ByteOrder = &nativeEndian{}

NativeEndian is either little endian or big endian, depending on the native endian-ness, and allocates memory and returns byte slices, for convenience.

Jump to

Keyboard shortcuts

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