mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 06:46:26 +01:00
Update to 4.5.3, remove unused code, zero user changes
This commit is contained in:
parent
f2a7b4e43a
commit
cd8a21c074
|
@ -2,26 +2,8 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/gob"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// SerializeBytes serializa bytes using gob encoder and returns them
|
|
||||||
func SerializeBytes(m interface{}) ([]byte, error) {
|
|
||||||
buf := new(bytes.Buffer)
|
|
||||||
enc := gob.NewEncoder(buf)
|
|
||||||
err := enc.Encode(m)
|
|
||||||
if err == nil {
|
|
||||||
return buf.Bytes(), nil
|
|
||||||
}
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
// DeserializeBytes converts the bytes to an object using gob decoder
|
|
||||||
func DeserializeBytes(b []byte, m interface{}) error {
|
|
||||||
dec := gob.NewDecoder(bytes.NewBuffer(b))
|
|
||||||
return dec.Decode(m) //no reference here otherwise doesn't work because of go remote object
|
|
||||||
}
|
|
||||||
|
|
||||||
// BufferPool implements a pool of bytes.Buffers in the form of a bounded channel.
|
// BufferPool implements a pool of bytes.Buffers in the form of a bounded channel.
|
||||||
// Pulled from the github.com/oxtoacart/bpool package (Apache licensed).
|
// Pulled from the github.com/oxtoacart/bpool package (Apache licensed).
|
||||||
type BufferPool struct {
|
type BufferPool struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user