Documentation ¶
Index ¶
- Constants
- func NewAggregate(errs []error) error
- func StringLen(str string) int
- type Closer
- type Errs
- type Packer
- func (p *Packer) PackBool(b bool)
- func (p *Packer) PackByte(val byte)
- func (p *Packer) PackBytes(bytes []byte)
- func (p *Packer) PackFixedBytes(bytes []byte)
- func (p *Packer) PackInt(val uint32)
- func (p *Packer) PackLong(val uint64)
- func (p *Packer) PackShort(val uint16)
- func (p *Packer) PackStr(str string)
- func (p *Packer) UnpackBool() bool
- func (p *Packer) UnpackByte() byte
- func (p *Packer) UnpackBytes() []byte
- func (p *Packer) UnpackFixedBytes(size int) []byte
- func (p *Packer) UnpackInt() uint32
- func (p *Packer) UnpackLimitedBytes(limit uint32) []byte
- func (p *Packer) UnpackLimitedStr(limit uint16) string
- func (p *Packer) UnpackLong() uint64
- func (p *Packer) UnpackShort() uint16
- func (p *Packer) UnpackStr() string
Constants ¶
const ( MaxStringLen = math.MaxUint16 // ByteLen is the number of bytes per byte... ByteLen = 1 // ShortLen is the number of bytes per short ShortLen = 2 // IntLen is the number of bytes per int IntLen = 4 // LongLen is the number of bytes per long LongLen = 8 // BoolLen is the number of bytes per bool BoolLen = 1 // IPLen is the number of bytes per IP IPLen = 16 + ShortLen )
Variables ¶
This section is empty.
Functions ¶
func NewAggregate ¶ added in v1.7.10
NewAggregate returns an aggregate error from a list of errors
Types ¶
type Closer ¶ added in v1.4.5
type Closer struct {
// contains filtered or unexported fields
}
Closer is a nice utility for closing a group of objects while reporting an error if one occurs.
type Packer ¶
type Packer struct { Errs // The largest allowed size of expanding the byte array MaxSize int // The current byte array Bytes []byte // The offset that is being written to in the byte array Offset int }
Packer packs and unpacks a byte array from/to standard values
func (*Packer) PackFixedBytes ¶
PackFixedBytes append a byte slice, with no length descriptor to the byte array
func (*Packer) UnpackBool ¶
UnpackBool unpacks a bool from the byte array
func (*Packer) UnpackByte ¶
UnpackByte unpack a byte from the byte array
func (*Packer) UnpackBytes ¶
UnpackBytes unpack a byte slice from the byte array
func (*Packer) UnpackFixedBytes ¶
UnpackFixedBytes unpack a byte slice, with no length descriptor from the byte array
func (*Packer) UnpackLimitedBytes ¶ added in v1.9.5
UnpackLimitedBytes unpacks a byte slice. If the size of the slice is greater than [limit], adds [errOversized] to the packer and returns nil.
func (*Packer) UnpackLimitedStr ¶ added in v1.9.5
UnpackLimitedStr unpacks a string. If the size of the string is greater than [limit], adds [errOversized] to the packer and returns the empty string.
func (*Packer) UnpackLong ¶
UnpackLong unpack a long from the byte array
func (*Packer) UnpackShort ¶
UnpackShort unpack a short from the byte array