// DecodeChannels decodes from the given byte array the list of channel names
// and return them as an array of strings.
501768
func DecodeChannels(data []byte) ([]string, error) {
	channels := []string{}
	pos := 0
	for pos < len(data) {
		if pos+2 > len(data) {
			return nil, fmt.Errorf("unable to decode size, pos=%v len=%v", pos, len(data))
		}
		cl := int(ByteOrder.Uint16(data[pos:]))
		pos += encodedChannelLen
		end := pos + cl
		if end > len(data) {
			return nil, fmt.Errorf("unable to decode channel, pos=%v len=%v max=%v (string=%v)",
				pos, cl, len(data), string(data[pos:]))
		}
		c := string(data[pos:end])
		channels = append(channels, c)
		pos = end
	}
	return channels, nil
}
1086554
func (r *PEXReactor) GetChannels() []*conn.ChannelDescriptor {
	return []*conn.ChannelDescriptor{
		{
			ID:                PexChannel,
			Priority:          1,
			SendQueueCapacity: 10,
		},
	}
}
444285
func (m *DataStream) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.MESSAGE_RATE)
	binary.Read(data, binary.LittleEndian, &m.STREAM_ID)
	binary.Read(data, binary.LittleEndian, &m.ON_OFF)
}
855332
func (m *RcChannelsScaled) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.TIME_BOOT_MS)
	binary.Read(data, binary.LittleEndian, &m.CHAN1_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN2_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN3_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN4_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN5_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN6_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN7_SCALED)
	binary.Read(data, binary.LittleEndian, &m.CHAN8_SCALED)
	binary.Read(data, binary.LittleEndian, &m.PORT)
	binary.Read(data, binary.LittleEndian, &m.RSSI)
}
669728
func (c *UsergroupsUpdateCall) Channels(channels string) *UsergroupsUpdateCall {
	c.channels = channels
	return c
}
1265939
func (enc Encoding) DecodeString(s string) ([]byte, error) {
	if enc.convert {
		s = convertEncoding(s)
	}
	return enc.encoding.DecodeString(ensurePadding(s))
}
1304653
func (q *QueryChannelRange) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		q.ChainHash[:],
		&q.FirstBlockHeight,
		&q.NumBlocks,
	)
}
206267
func (s *Filters) SetChannels(v []*string) *Filters {
	s.Channels = v
	return s
}
153853
func (p *Buffer) DecodeStringBytes() (s string, err error) {
	buf, err := p.DecodeRawBytes(false)
	if err != nil {
		return
	}
	return string(buf), nil
}
1194965
func (d Decoder) DecodeString(dst interface{}, src string) error {
	vs, err := url.ParseQuery(src)
	if err != nil {
		return err
	}
	v := reflect.ValueOf(dst)
	return d.decodeNode(v, parseValues(d.d, d.e, vs, canIndexOrdinally(v)))
}
1202154
func DecodeBytes(buf []byte) (Store, error) {
	s := Store{}
	err := Decode(s, buf)
	if err != nil {
		return nil, err
	}

	return s, nil
}
736132
func decodeSurrogates(s string) string {
	var (
		r1  rune = 0
		buf      = new(bytes.Buffer)
	)
	for _, r := range s {
		if utf16.IsSurrogate(r) {
			if r1 == 0 {
				r1 = r
			} else {
				buf.WriteRune(utf16.DecodeRune(r1, r))
				r1 = 0
			}
		} else {
			if r1 != 0 {
				buf.WriteRune(r1)
				r1 = 0
			}
			buf.WriteRune(r)
		}
	}
	return buf.String()
}
1141702
func DecodeString(src string) (body []byte, err error) {
	body, err = Encoding.DecodeString(src)
	return
}
79848
func DecodeArray(data []byte) ([]interface{}, error) {
	d := NewDecoder(data)
	if c := d.skipSpaces(); c != '[' {
		return nil, d.error(c, "looking for beginning of array")
	}
	val, err := d.array()
	if err != nil {
		return nil, err
	}
	if c := d.skipSpaces(); d.pos < d.end {
		return nil, d.error(c, "after top-level value")
	}
	return val, nil
}
773268
func DecodeValues(dst interface{}, vs url.Values) error {
	return NewDecoder(nil).DecodeValues(dst, vs)
}
73905
func (s *AudioParameters) SetChannels(v string) *AudioParameters {
	s.Channels = &v
	return s
}
696829
func Decode(code *string) error {
	// Don't decode empty strings
	if *code == "" {
		return nil
	}
	unhexedBytes, err := hex.DecodeString(*code)
	if err != nil {
		return err
	}
	buf := bytes.NewBuffer(unhexedBytes)
	decompressorReader := flate.NewReader(buf)
	decompressedBytes, err := ioutil.ReadAll(decompressorReader)
	decompressorReader.Close()
	if err != nil {
		return err
	}
	*code = string(decompressedBytes)
	return nil
}