binaryencode

package module
v0.0.0-...-2b01bdc Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BigEndian    = true
	LittleEndian = false
)

Variables

View Source
var (
	ErrStringOverflow = errors.New("binary: string too large")
)

Functions

func Marshal

func Marshal(in interface{}, args EncoderArgs) []byte

func Unmarshal

func Unmarshal(in io.Reader, out interface{}, args EncoderArgs) error

Types

type EncoderArgs

type EncoderArgs struct {
	DefaultEndianess bool
	MaxStringLength  int
}

type LengthString

type LengthString []byte // a byte array that will be encoded as an 8 bit length prefixed string

type LengthString16

type LengthString16 []byte // a byte array that will be encoded as a 16 bit length prefixed string

type LengthString32

type LengthString32 []byte // a byte array that will be encoded as a 32 bit length prefixed string

type LengthString64

type LengthString64 []byte // a byte array that will be encoded as a 64 bit length prefixed string. you probably dont want to use this because internally an int is used for length, this is just here for compatability

type NullString

type NullString []byte

a byte array that will be encoded as a null terminated string

type Padding

type Padding interface{}

this will encode into n ignored/null bytes determined by the tag `binary:"i,n"`

Jump to

Keyboard shortcuts

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