Documentation
¶
Index ¶
- Constants
- type BinaryReader
- func (b *BinaryReader) Int16(bs []byte) (v int16, err error)
- func (b *BinaryReader) Int32(bs []byte) (v int32, err error)
- func (b *BinaryReader) Int64(bs []byte) (v int64, err error)
- func (b *BinaryReader) Uint16(bs []byte) (v uint16, err error)
- func (b *BinaryReader) Uint32(bs []byte) (v uint32, err error)
- func (b *BinaryReader) Uint64(bs []byte) (v uint64, err error)
- type BinaryWriter
- func (b *BinaryWriter) Int8(v int8) []byte
- func (b *BinaryWriter) Int16(v int16) []byte
- func (b *BinaryWriter) Int32(v int32) []byte
- func (b *BinaryWriter) Int64(v int64) []byte
- func (b *BinaryWriter) Uint8(v uint8) []byte
- func (b *BinaryWriter) Uint16(v uint16) []byte
- func (b *BinaryWriter) Uint32(v uint32) []byte
- func (b *BinaryWriter) Uint64(v uint64) []byte
- type Decodee
- type Decoder
- func (d *Decoder) Bool() (v bool, err error)
- func (d *Decoder) Bytes() (v []byte, err error)
- func (d *Decoder) BytesUnsafe() (v []byte, err error)
- func (d *Decoder) Decode(v Decodee) (err error)
- func (d *Decoder) Float32() (v float32, err error)
- func (d *Decoder) Float64() (v float64, err error)
- func (d *Decoder) Int() (v int, err error)
- func (d *Decoder) Int8() (v int8, err error)
- func (d *Decoder) Int16() (v int16, err error)
- func (d *Decoder) Int32() (v int32, err error)
- func (d *Decoder) Int64() (v int64, err error)
- func (d *Decoder) String() (v string, err error)
- func (d *Decoder) Uint() (v uint, err error)
- func (d *Decoder) Uint8() (v uint8, err error)
- func (d *Decoder) Uint16() (v uint16, err error)
- func (d *Decoder) Uint32() (v uint32, err error)
- func (d *Decoder) Uint64() (v uint64, err error)
- type Encodee
- type Encoder
- func (e *Encoder) Bool(v bool) (err error)
- func (e *Encoder) Bytes(v []byte) (err error)
- func (e *Encoder) Encode(v Encodee) (err error)
- func (e *Encoder) Float32(v float32) (err error)
- func (e *Encoder) Float64(v float64) (err error)
- func (e *Encoder) Int(v int) (err error)
- func (e *Encoder) Int8(v int8) (err error)
- func (e *Encoder) Int16(v int16) (err error)
- func (e *Encoder) Int32(v int32) (err error)
- func (e *Encoder) Int64(v int64) (err error)
- func (e *Encoder) String(v string) (err error)
- func (e *Encoder) Uint(v uint) (err error)
- func (e *Encoder) Uint8(v uint8) (err error)
- func (e *Encoder) Uint16(v uint16) (err error)
- func (e *Encoder) Uint32(v uint32) (err error)
- func (e *Encoder) Uint64(v uint64) (err error)
- type Type
Constants ¶
const ( // ErrInvalidLength is returned when a byteslice has an invalid length for it's desired primitive ErrInvalidLength = errors.Error("invalid length") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryReader ¶
type BinaryReader struct{}
BinaryReader will read numbers from binary bytes
func (*BinaryReader) Int16 ¶
func (b *BinaryReader) Int16(bs []byte) (v int16, err error)
Int16 will return the int16 value from a provided byteslice
func (*BinaryReader) Int32 ¶
func (b *BinaryReader) Int32(bs []byte) (v int32, err error)
Int32 will return the int32 value from a provided byteslice
func (*BinaryReader) Int64 ¶
func (b *BinaryReader) Int64(bs []byte) (v int64, err error)
Int64 will return the int64 value from a provided byteslice
func (*BinaryReader) Uint16 ¶
func (b *BinaryReader) Uint16(bs []byte) (v uint16, err error)
Uint16 will return the uint16 value from a provided byteslice
type BinaryWriter ¶
type BinaryWriter struct {
// contains filtered or unexported fields
}
BinaryWriter will write numbers as binary bytes
func (*BinaryWriter) Int8 ¶
func (b *BinaryWriter) Int8(v int8) []byte
Int8 will return the byteslice representation of a int8 value
func (*BinaryWriter) Int16 ¶
func (b *BinaryWriter) Int16(v int16) []byte
Int16 will return the byteslice representation of a int16 value
func (*BinaryWriter) Int32 ¶
func (b *BinaryWriter) Int32(v int32) []byte
Int32 will return the byteslice representation of a int32 value
func (*BinaryWriter) Int64 ¶
func (b *BinaryWriter) Int64(v int64) []byte
Int64 will return the byteslice representation of a int64 value
func (*BinaryWriter) Uint8 ¶
func (b *BinaryWriter) Uint8(v uint8) []byte
Uint8 will return the byteslice representation of a uint8 value
func (*BinaryWriter) Uint16 ¶
func (b *BinaryWriter) Uint16(v uint16) []byte
Uint16 will return the byteslice representation of a uint16 value
func (*BinaryWriter) Uint32 ¶
func (b *BinaryWriter) Uint32(v uint32) []byte
Uint32 will return the byteslice representation of a uint32 value
func (*BinaryWriter) Uint64 ¶
func (b *BinaryWriter) Uint64(v uint64) []byte
Uint64 will return the byteslice representation of a uint64 value
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder helps to Marshal data
func (*Decoder) BytesUnsafe ¶
BytesUnsafe will return decoded bytes without copying
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder helps to Marshal data
type Type ¶
type Type uint8
Type represents a primitive type
const ( // Nil is the zero-value for the Types block Nil Type = iota // UInt8 represents uint8 UInt8 // UInt16 represents uint16 UInt16 // UInt32 represents uint32 UInt32 // UInt64 represents uin64 UInt64 // Int8 represents int8 Int8 // Int16 represents int16 Int16 // Int32 represents int32 Int32 // Int64 represents int64 Int64 // Bytes represents a byteslice Bytes // String represents a string String )