// Decode reads from the byte slice argument. It returns the total number of
// bytes decoded, and whether there have been any errors during the process.
774562
func (up *Unsuback) Decode(src []byte) (int, error) {
	n, pid, err := identifiedDecode(src, UNSUBACK)
	up.ID = pid
	return n, err
}
261297
func Decode(upper, lower byte) Type {
	return Type(binary.BigEndian.Uint16([]byte{upper, lower}))
}
1081075
func Decode(dst, src []byte) (int, error) {
	dLen := DecodedLen(len(src))
	if EncodedLen(dLen) != len(src) {
		return 0, ErrLength
	}
	if len(dst) < dLen {
		panic("dst has insufficient length")
	}
	dst = dst[:0]
	whichByte := uint(1)
	bufByte := byte(0)
	for _, v := range src {
		if (v & 0x80) != 0 {
			return len(dst), ErrBit
		}
		if whichByte > 1 {
			dst = append(dst, bufByte|(v>>(8-whichByte)))
		}
		bufByte = v << whichByte
		if whichByte == 8 {
			whichByte = 0
		}
		whichByte++
	}
	return len(dst), nil
}
1296655
func Decode(r io.Reader, v interface{}, order binary.ByteOrder) error {
	b, err := Read(r, order)
	if err != nil {
		return err
	}
	err = json.Unmarshal(b, v)
	if err != nil {
		return errors.New(err.Error() + string(b))
	}
	return nil
}
88846
func (d *Decoder) Decode(v interface{}) error {
	b, err := ioutil.ReadAll(d.r)
	if err != nil {
		return err
	}
	return d.cfg.Unmarshal(b, v)
}
173231
func (e MsgPakEncoderDecoder) Decode(buf []byte, out interface{}) error {
	reader := bytes.NewReader(buf)
	handle := codec.MsgpackHandle{}
	decoder := codec.NewDecoder(reader, &handle)
	return decoder.Decode(out)
}
506321
func Decode(r io.Reader, v interface{}) error {
	ini, err := New(DefaultOptions...)
	if err != nil {
		return err
	}
	if _, err := ini.ReadFrom(r); err != nil {
		return err
	}
	return ini.Decode(v)
}
886302
func (c *Codec) Decode(buffer []byte) (*Chunk, []byte) {
	chk := &Chunk{}
	for ordinal := 0; len(buffer) > 0; ordinal++ {
		col := &column{}
		buffer = c.decodeColumn(buffer, col, ordinal)
		chk.columns = append(chk.columns, col)
	}
	return chk, buffer
}
115920
func Decode(buf []byte, out interface{}) error {
	return codec.NewDecoder(bytes.NewReader(buf), MsgpackHandle).Decode(out)
}
600444
func (dec *skipDecoder) Decode(iter *Iterator) (bool, error) {
	if iter.Error() != nil {
		return false, iter.Error()
	}
	for iter.Valid() {
		key, _, err := mvccDecode(iter.Key())
		if err != nil {
			return false, errors.Trace(err)
		}
		if !bytes.Equal(key, dec.currKey) {
			dec.currKey = key
			return true, nil
		}
		iter.Next()
	}
	return false, nil
}
681304
func Decode(d []byte, v interface{}) error {
	zr, err := zlib.NewReader(bytes.NewReader(d))
	if err != nil {
		return errors.Annotate(err, "failed to create zlib Reader").Err()
	}
	defer zr.Close()

	if err := json.NewDecoder(zr).Decode(v); err != nil {
		return errors.Annotate(err, "failed to JSON-decode").Err()
	}
	return nil
}
1225626
func (enc Encoding) Decode(dst, src []byte) (int, error) {
	data := ensurePadding(string(src))
	if enc.convert {
		data = convertEncoding(data)
	}
	return enc.encoding.Decode(dst, []byte(data))
}
251202
func Decode(in string) ([]byte, error) {
	out, err := Client().Decode(in)
	Trace("Decode", err, logrus.Fields{"in": in, "out": out})
	return out, err
}
360732
func (jsonEncoderDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}
789173
func Decode(b []byte) (int64, int) {
	if len(b) == 0 {
		return 0, 0
	}
	// 0xxxxxxx 7-bit positive number
	if (b[0] & 0x80) == 0 {
		return int64(b[0]), 1
	}
	// 10xxxxxx + 1 byte 14-bit positive number
	if (b[0]&0xC0) == 0x80 && len(b) >= 2 {
		return int64(b[0]&0x3F)<<8 | int64(b[1]), 2
	}
	// 110xxxxx + 2 bytes 21-bit positive number
	if (b[0]&0xE0) == 0xC0 && len(b) >= 3 {
		return int64(b[0]&0x1F)<<16 | int64(b[1])<<8 | int64(b[2]), 3
	}
	// 1110xxxx + 3 bytes 28-bit positive number
	if (b[0]&0xF0) == 0xE0 && len(b) >= 4 {
		return int64(b[0]&0xF)<<24 | int64(b[1])<<16 | int64(b[2])<<8 | int64(b[3]), 4
	}
	// 111100__ + int (32-bit) 32-bit positive number
	if (b[0]&0xFC) == 0xF0 && len(b) >= 5 {
		return int64(binary.BigEndian.Uint32(b[1:])), 5
	}
	// 111101__ + long (64-bit) 64-bit number
	if (b[0]&0xFC) == 0xF4 && len(b) >= 9 {
		return int64(binary.BigEndian.Uint64(b[1:])), 9
	}
	// 111110__ + varint Negative recursive varint
	if b[0]&0xFC == 0xF8 {
		if v, n := Decode(b[1:]); n > 0 {
			return -v, n + 1
		}
		return 0, 0
	}
	// 111111xx Byte-inverted negative two bit number (~xx)
	if b[0]&0xFC == 0xFC {
		return ^int64(b[0] & 0x03), 1
	}

	return 0, 0
}
37541
func (m *EncapsulatedData) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.SEQNR)
	binary.Read(data, binary.LittleEndian, &m.DATA)
}
361892
func (u *DefaultDecoder) Decode(data []byte, v interface{}) error {
	return json.Unmarshal(data, v)
}