Documentation ¶
Overview ¶
Package codec implements encoding and decoding of multiple codecs
Index ¶
- type BYTESCodec
- type BYTESCodecPool
- type CODECodec
- type CODECodecPool
- type Code
- type Codec
- type GOBCodec
- type GOBCodecPool
- type GOGOPBCodec
- type GOGOPBCodecPool
- type JSONCodec
- type JSONCodecPool
- type MSGPCodec
- type MSGPCodecPool
- type PBCodec
- type PBCodecPool
- type Pool
- type XMLCodec
- type XMLCodecPool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BYTESCodec ¶
type BYTESCodec struct { }
BYTESCodec struct
func (*BYTESCodec) Decode ¶
func (c *BYTESCodec) Decode(data []byte, v interface{}) error
Decode parses the BYTES-encoded data and stores the result in the value pointed to by v.
func (*BYTESCodec) Encode ¶
func (c *BYTESCodec) Encode(v interface{}) ([]byte, error)
Encode returns the BYTES encoding of v.
type BYTESCodecPool ¶
type BYTESCodecPool struct {
// contains filtered or unexported fields
}
BYTESCodecPool implements a pool of BYTESCodec in the form of a bounded channel.
func NewBYTESCodecPool ¶
func NewBYTESCodecPool(total int) *BYTESCodecPool
NewBYTESCodecPool creates a new BYTESCodecPool bounded to the given total.
func (*BYTESCodecPool) Get ¶
func (cp *BYTESCodecPool) Get() (c Codec)
Get gets a BYTESCodec from the BYTESCodecPool, or creates a new one if none are available in the pool.
func (*BYTESCodecPool) Put ¶
func (cp *BYTESCodecPool) Put(c Codec)
Put returns the given BYTESCodec to the BYTESCodecPool.
type CODECodec ¶
type CODECodec struct {
Buffer []byte
}
CODECodec struct
type CODECodecPool ¶
type CODECodecPool struct {
// contains filtered or unexported fields
}
CODECodecPool implements a pool of CODECodec in the form of a bounded channel.
func NewCODECodecPool ¶
func NewCODECodecPool(total int, width int) *CODECodecPool
NewCODECodecPool creates a new CODECodecPool bounded to the given total.
func (*CODECodecPool) Get ¶
func (cp *CODECodecPool) Get() (c Codec)
Get gets a CODECodec from the CODECodecPool, or creates a new one if none are available in the pool.
func (*CODECodecPool) Put ¶
func (cp *CODECodecPool) Put(c Codec)
Put returns the given CODECodec to the CODECodecPool.
type Codec ¶
type Codec interface { Encode(v interface{}) ([]byte, error) Decode(data []byte, v interface{}) error }
Codec defines the interface for encoding/decoding.
type GOBCodec ¶
type GOBCodec struct {
// contains filtered or unexported fields
}
GOBCodec struct
type GOBCodecPool ¶
type GOBCodecPool struct {
// contains filtered or unexported fields
}
GOBCodecPool implements a pool of GOBCodec in the form of a bounded channel.
func NewGOBCodecPool ¶
func NewGOBCodecPool(total int) *GOBCodecPool
NewGOBCodecPool creates a new GOBCodecPool bounded to the given total.
func (*GOBCodecPool) Get ¶
func (cp *GOBCodecPool) Get() (c Codec)
Get gets a GOBCodec from the GOBCodecPool, or creates a new one if none are available in the pool.
func (*GOBCodecPool) Put ¶
func (cp *GOBCodecPool) Put(c Codec)
Put returns the given GOBCodec to the GOBCodecPool.
type GOGOPBCodec ¶
type GOGOPBCodec struct {
Buffer []byte
}
GOGOPBCodec struct
func (*GOGOPBCodec) Decode ¶
func (c *GOGOPBCodec) Decode(data []byte, v interface{}) error
Decode parses the GOGOPB-encoded data and stores the result in the value pointed to by v.
func (*GOGOPBCodec) Encode ¶
func (c *GOGOPBCodec) Encode(v interface{}) ([]byte, error)
Encode returns the GOGOPB encoding of v.
type GOGOPBCodecPool ¶
type GOGOPBCodecPool struct {
// contains filtered or unexported fields
}
GOGOPBCodecPool implements a pool of GOGOPBCodec in the form of a bounded channel.
func NewGOGOPBCodecPool ¶
func NewGOGOPBCodecPool(total int, width int) *GOGOPBCodecPool
NewGOGOPBCodecPool creates a new GOGOPBCodecPool bounded to the given total.
func (*GOGOPBCodecPool) Get ¶
func (cp *GOGOPBCodecPool) Get() (c Codec)
Get gets a GOGOPBCodec from the GOGOPBCodecPool, or creates a new one if none are available in the pool.
func (*GOGOPBCodecPool) Put ¶
func (cp *GOGOPBCodecPool) Put(c Codec)
Put returns the given GOGOPBCodec to the GOGOPBCodecPool.
type JSONCodec ¶
type JSONCodec struct { }
JSONCodec struct
type JSONCodecPool ¶
type JSONCodecPool struct {
// contains filtered or unexported fields
}
JSONCodecPool implements a pool of JSONCodec in the form of a bounded channel.
func NewJSONCodecPool ¶
func NewJSONCodecPool(total int) *JSONCodecPool
NewJSONCodecPool creates a new JSONCodecPool bounded to the given total.
func (*JSONCodecPool) Get ¶
func (cp *JSONCodecPool) Get() (c Codec)
Get gets a JSONCodec from the JSONCodecPool, or creates a new one if none are available in the pool.
func (*JSONCodecPool) Put ¶
func (cp *JSONCodecPool) Put(c Codec)
Put returns the given JSONCodec to the JSONCodecPool.
type MSGPCodec ¶
type MSGPCodec struct {
Buffer []byte
}
MSGPCodec struct
type MSGPCodecPool ¶
type MSGPCodecPool struct {
// contains filtered or unexported fields
}
MSGPCodecPool implements a pool of MSGPCodec in the form of a bounded channel.
func NewMSGPCodecPool ¶
func NewMSGPCodecPool(total int, width int) *MSGPCodecPool
NewMSGPCodecPool creates a new MSGPCodecPool bounded to the given total.
func (*MSGPCodecPool) Get ¶
func (cp *MSGPCodecPool) Get() (c Codec)
Get gets a MSGPCodec from the MSGPCodecPool, or creates a new one if none are available in the pool.
func (*MSGPCodecPool) Put ¶
func (cp *MSGPCodecPool) Put(c Codec)
Put returns the given MSGPCodec to the MSGPCodecPool.
type PBCodec ¶
type PBCodec struct { }
PBCodec struct
type PBCodecPool ¶
type PBCodecPool struct {
// contains filtered or unexported fields
}
PBCodecPool implements a pool of PBCodec in the form of a bounded channel.
func NewPBCodecPool ¶
func NewPBCodecPool(total int) *PBCodecPool
NewPBCodecPool creates a new PBCodecPool bounded to the given total.
func (*PBCodecPool) Get ¶
func (cp *PBCodecPool) Get() (c Codec)
Get gets a PBCodec from the PBCodecPool, or creates a new one if none are available in the pool.
func (*PBCodecPool) Put ¶
func (cp *PBCodecPool) Put(c Codec)
Put returns the given PBCodec to the PBCodecPool.
type XMLCodec ¶
type XMLCodec struct { }
XMLCodec struct
type XMLCodecPool ¶
type XMLCodecPool struct {
// contains filtered or unexported fields
}
XMLCodecPool implements a pool of XMLCodec in the form of a bounded channel.
func NewXMLCodecPool ¶
func NewXMLCodecPool(total int) *XMLCodecPool
NewXMLCodecPool creates a new XMLCodecPool bounded to the given total.
func (*XMLCodecPool) Get ¶
func (cp *XMLCodecPool) Get() (c Codec)
Get gets a XMLCodec from the XMLCodecPool, or creates a new one if none are available in the pool.
func (*XMLCodecPool) Put ¶
func (cp *XMLCodecPool) Put(c Codec)
Put returns the given XMLCodec to the XMLCodecPool.