barrel

package module
v0.0.0-...-9316d01 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2018 License: MIT Imports: 7 Imported by: 8

README

barrel

Very fast binary marshaller to struct and back

Documentation

Index

Constants

View Source
const (
	BigEndian = iota
	LittleEndian
)

Variables

View Source
var (
	// ErrNotEnoughBytes represents about not enough bytes in buffer
	ErrNotEnoughBytes = errors.New("Not enough bytes in buffer")
)

Functions

This section is empty.

Types

type Barrel

type Barrel struct {
	Object Unit

	Stats Stats
	// contains filtered or unexported fields
}

func NewBarrel

func NewBarrel() *Barrel

func (*Barrel) Bytes

func (b *Barrel) Bytes() []byte

func (*Barrel) Load

func (b *Barrel) Load(object Unit, buffer []byte, def bool) reflect.Value

func (*Barrel) Pack

func (b *Barrel) Pack(value reflect.Value) error

func (*Barrel) Unpack

func (b *Barrel) Unpack(value reflect.Value) error

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor struct for network library

func NewProcessor

func NewProcessor(buf []byte) *Processor

NewProcessor method for init Processor struct

func (*Processor) Buffer

func (p *Processor) Buffer() *bytes.Buffer

Buffer method for get pointer to bytes.Buffer

func (*Processor) Bytes

func (p *Processor) Bytes() []byte

Bytes method for get []byte from buffer

func (*Processor) ClearError

func (p *Processor) ClearError() *Processor

func (*Processor) Clone

func (p *Processor) Clone() []byte

Bytes method to copy []byte from buffer

func (*Processor) Endian

func (p *Processor) Endian() int

Endian method for get current endian number

func (*Processor) Error

func (p *Processor) Error() error

Error method for get error from netes

func (*Processor) ReadArray

func (p *Processor) ReadArray(value *[]byte, ln int) *Processor

func (*Processor) ReadBool

func (p *Processor) ReadBool(value *bool) *Processor

func (*Processor) ReadBytes

func (p *Processor) ReadBytes(value *[]byte, ln int) *Processor

func (*Processor) ReadFloat32

func (p *Processor) ReadFloat32(value *float32) *Processor

func (*Processor) ReadFloat64

func (p *Processor) ReadFloat64(value *float64) *Processor

func (*Processor) ReadInt16

func (p *Processor) ReadInt16(value *int16) *Processor

func (*Processor) ReadInt32

func (p *Processor) ReadInt32(value *int32) *Processor

func (*Processor) ReadInt64

func (p *Processor) ReadInt64(value *int64) *Processor

func (*Processor) ReadInt8

func (p *Processor) ReadInt8(value *int8) *Processor

func (*Processor) ReadString

func (p *Processor) ReadString(value *string) *Processor

func (*Processor) ReadString1251

func (p *Processor) ReadString1251(value *string) *Processor

func (*Processor) ReadStringEOF

func (p *Processor) ReadStringEOF(value *string) *Processor

func (*Processor) ReadStringWithLen

func (p *Processor) ReadStringWithLen(ln int32, value *string) *Processor

func (*Processor) ReadUint16

func (p *Processor) ReadUint16(value *uint16) *Processor

func (*Processor) ReadUint32

func (p *Processor) ReadUint32(value *uint32) *Processor

func (*Processor) ReadUint64

func (p *Processor) ReadUint64(value *uint64) *Processor

func (*Processor) ReadUint8

func (p *Processor) ReadUint8(value *uint8) *Processor

func (*Processor) Reset

func (p *Processor) Reset()

Reset method for reset buffer

func (*Processor) SetEndian

func (p *Processor) SetEndian(endian int) *Processor

SetEndian method for set endian in buffer

func (*Processor) Skip

func (p *Processor) Skip(ln int) *Processor

func (*Processor) WriteBool

func (p *Processor) WriteBool(value bool) *Processor

func (*Processor) WriteByte

func (p *Processor) WriteByte(value byte) *Processor

func (*Processor) WriteBytes

func (p *Processor) WriteBytes(value []byte) *Processor

func (*Processor) WriteFloat32

func (p *Processor) WriteFloat32(value float32) *Processor

func (*Processor) WriteFloat64

func (p *Processor) WriteFloat64(value float64) *Processor

func (*Processor) WriteInt16

func (p *Processor) WriteInt16(value int16) *Processor

func (*Processor) WriteInt32

func (p *Processor) WriteInt32(value int32) *Processor

func (*Processor) WriteInt64

func (p *Processor) WriteInt64(value int64) *Processor

func (*Processor) WriteInt8

func (p *Processor) WriteInt8(value int8) *Processor

func (*Processor) WriteString

func (p *Processor) WriteString(value string) *Processor

func (*Processor) WriteString1251

func (p *Processor) WriteString1251(value string) *Processor

func (*Processor) WriteToBuffer

func (p *Processor) WriteToBuffer(buf []byte) error

WriteToBuffer writes bytes to the buffer

func (*Processor) WriteUint16

func (p *Processor) WriteUint16(value uint16) *Processor

func (*Processor) WriteUint32

func (p *Processor) WriteUint32(value uint32) *Processor

func (*Processor) WriteUint64

func (p *Processor) WriteUint64(value uint64) *Processor

func (*Processor) WriteUint8

func (p *Processor) WriteUint8(value uint8) *Processor

type Stats

type Stats struct {
	LenSlice  int
	NameField string
	Endian    int
}

type Unit

type Unit interface {
	Default()
	Check(*Stats) bool
}

Jump to

Keyboard shortcuts

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