bin

package module
v0.0.0-...-781c575 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2018 License: Apache-2.0 Imports: 5 Imported by: 2

README

go-bin

Support for encoding/decoding buffers using casts into go structures

Documentation

Overview

This file has been generated from 'bin.yml', do not edit

Index

Constants

This section is empty.

Variables

View Source
var NativeEndian = binary.LittleEndian

Architecture native encoding

Functions

func CastStruct

func CastStruct(to interface{}, b []byte) error

CastStruct casts a byte slice its contents into an arbitrary go-structure. The structure passed must be a pointer to a pointer of a structed to be casted too. An error is returned if the input type is invalid or the buffer is not big enough to hold the structure. If the input buffers length is 0, `to` will be set to nil.

func UnsafeCastStruct

func UnsafeCastStruct(to interface{}, b []byte)

UnsafeCastStruct casts a byte slice its contents into an arbitrary go-structure. The structure passed must be a pointer to a pointer of a struct to be casted too.

If the input buffers length is 0, `to` will be set to nil.

The operation is unsafe, as it does not validate the input value to be a pointer of a pointer, plus no length check is executed.

Types

type I16

type I16 = I16le

type I16be

type I16be [2]byte

I16be wraps a byte array into a big endian encoded 16bit signed integer.

func (*I16be) Get

func (b *I16be) Get() int16

Get returns the decoded value.

func (*I16be) Len

func (b *I16be) Len() int

Len returns the number of bytes required to store the value.

func (*I16be) Set

func (b *I16be) Set(v int16)

Set encodes a new value into the backing buffer:

type I16le

type I16le [2]byte

I16le wraps a byte array into a little endian encoded 16bit signed integer.

func (*I16le) Get

func (b *I16le) Get() int16

Get returns the decoded value.

func (*I16le) Len

func (b *I16le) Len() int

Len returns the number of bytes required to store the value.

func (*I16le) Set

func (b *I16le) Set(v int16)

Set encodes a new value into the backing buffer:

type I32

type I32 = I32le

type I32be

type I32be [4]byte

I32be wraps a byte array into a big endian encoded 32bit signed integer.

func (*I32be) Get

func (b *I32be) Get() int32

Get returns the decoded value.

func (*I32be) Len

func (b *I32be) Len() int

Len returns the number of bytes required to store the value.

func (*I32be) Set

func (b *I32be) Set(v int32)

Set encodes a new value into the backing buffer:

type I32le

type I32le [4]byte

I32le wraps a byte array into a little endian encoded 32bit signed integer.

func (*I32le) Get

func (b *I32le) Get() int32

Get returns the decoded value.

func (*I32le) Len

func (b *I32le) Len() int

Len returns the number of bytes required to store the value.

func (*I32le) Set

func (b *I32le) Set(v int32)

Set encodes a new value into the backing buffer:

type I64

type I64 = I64le

type I64be

type I64be [8]byte

I64be wraps a byte array into a big endian encoded 64bit signed integer.

func (*I64be) Get

func (b *I64be) Get() int64

Get returns the decoded value.

func (*I64be) Len

func (b *I64be) Len() int

Len returns the number of bytes required to store the value.

func (*I64be) Set

func (b *I64be) Set(v int64)

Set encodes a new value into the backing buffer:

type I64le

type I64le [8]byte

I64le wraps a byte array into a little endian encoded 64bit signed integer.

func (*I64le) Get

func (b *I64le) Get() int64

Get returns the decoded value.

func (*I64le) Len

func (b *I64le) Len() int

Len returns the number of bytes required to store the value.

func (*I64le) Set

func (b *I64le) Set(v int64)

Set encodes a new value into the backing buffer:

type I8

type I8 = I8le

type I8be

type I8be [1]byte

I8be wraps a byte array into a big endian encoded 8bit signed integer.

func (*I8be) Get

func (b *I8be) Get() int8

Get returns the decoded value.

func (*I8be) Len

func (b *I8be) Len() int

Len returns the number of bytes required to store the value.

func (*I8be) Set

func (b *I8be) Set(v int8)

Set encodes a new value into the backing buffer:

type I8le

type I8le [1]byte

I8le wraps a byte array into a little endian encoded 8bit signed integer.

func (*I8le) Get

func (b *I8le) Get() int8

Get returns the decoded value.

func (*I8le) Len

func (b *I8le) Len() int

Len returns the number of bytes required to store the value.

func (*I8le) Set

func (b *I8le) Set(v int8)

Set encodes a new value into the backing buffer:

type U16

type U16 = U16le

type U16be

type U16be [2]byte

U16be wraps a byte array into a big endian encoded 16bit unsigned integer.

func (*U16be) Get

func (b *U16be) Get() uint16

Get returns the decoded value.

func (*U16be) Len

func (b *U16be) Len() int

Len returns the number of bytes required to store the value.

func (*U16be) Set

func (b *U16be) Set(v uint16)

Set encodes a new value into the backing buffer:

type U16le

type U16le [2]byte

U16le wraps a byte array into a little endian encoded 16bit unsigned integer.

func (*U16le) Get

func (b *U16le) Get() uint16

Get returns the decoded value.

func (*U16le) Len

func (b *U16le) Len() int

Len returns the number of bytes required to store the value.

func (*U16le) Set

func (b *U16le) Set(v uint16)

Set encodes a new value into the backing buffer:

type U32

type U32 = U32le

type U32be

type U32be [4]byte

U32be wraps a byte array into a big endian encoded 32bit unsigned integer.

func (*U32be) Get

func (b *U32be) Get() uint32

Get returns the decoded value.

func (*U32be) Len

func (b *U32be) Len() int

Len returns the number of bytes required to store the value.

func (*U32be) Set

func (b *U32be) Set(v uint32)

Set encodes a new value into the backing buffer:

type U32le

type U32le [4]byte

U32le wraps a byte array into a little endian encoded 32bit unsigned integer.

func (*U32le) Get

func (b *U32le) Get() uint32

Get returns the decoded value.

func (*U32le) Len

func (b *U32le) Len() int

Len returns the number of bytes required to store the value.

func (*U32le) Set

func (b *U32le) Set(v uint32)

Set encodes a new value into the backing buffer:

type U64

type U64 = U64le

type U64be

type U64be [8]byte

U64be wraps a byte array into a big endian encoded 64bit unsigned integer.

func (*U64be) Get

func (b *U64be) Get() uint64

Get returns the decoded value.

func (*U64be) Len

func (b *U64be) Len() int

Len returns the number of bytes required to store the value.

func (*U64be) Set

func (b *U64be) Set(v uint64)

Set encodes a new value into the backing buffer:

type U64le

type U64le [8]byte

U64le wraps a byte array into a little endian encoded 64bit unsigned integer.

func (*U64le) Get

func (b *U64le) Get() uint64

Get returns the decoded value.

func (*U64le) Len

func (b *U64le) Len() int

Len returns the number of bytes required to store the value.

func (*U64le) Set

func (b *U64le) Set(v uint64)

Set encodes a new value into the backing buffer:

type U8

type U8 = U8le

type U8be

type U8be [1]byte

U8be wraps a byte array into a big endian encoded 8bit unsigned integer.

func (*U8be) Get

func (b *U8be) Get() uint8

Get returns the decoded value.

func (*U8be) Len

func (b *U8be) Len() int

Len returns the number of bytes required to store the value.

func (*U8be) Set

func (b *U8be) Set(v uint8)

Set encodes a new value into the backing buffer:

type U8le

type U8le [1]byte

U8le wraps a byte array into a little endian encoded 8bit unsigned integer.

func (*U8le) Get

func (b *U8le) Get() uint8

Get returns the decoded value.

func (*U8le) Len

func (b *U8le) Len() int

Len returns the number of bytes required to store the value.

func (*U8le) Set

func (b *U8le) Set(v uint8)

Set encodes a new value into the backing buffer:

Jump to

Keyboard shortcuts

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