//Decode is called to turn a body supplied by the client into an object of the appropriate
//wire type.  Note that the interface{} passed here _must_ be pointer.
12628
func (self *JsonDecoder) Decode(body []byte, wireType interface{}) error {
	err := json.Unmarshal(body, wireType)
	return err
}
1077541
func (c *UpdateFee) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		&c.ChanID,
		&c.FeePerKw,
	)
}
148387
func Decode(value string) (string, error) {
	value = value
	decoded := make([]byte, base64.URLEncoding.DecodedLen(len(value)))
	b, err := base64.URLEncoding.Decode(decoded, []byte(value))
	if err != nil {
		return "", err
	}
	return string(decoded[:b]), nil
}
729483
func (m *RcChannelsOverride) Decode(buf []byte) {
	data := bytes.NewBuffer(buf)
	binary.Read(data, binary.LittleEndian, &m.CHAN1_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN2_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN3_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN4_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN5_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN6_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN7_RAW)
	binary.Read(data, binary.LittleEndian, &m.CHAN8_RAW)
	binary.Read(data, binary.LittleEndian, &m.TARGET_SYSTEM)
	binary.Read(data, binary.LittleEndian, &m.TARGET_COMPONENT)
}
1069164
func (adapter *Decoder) Decode(obj interface{}) error {
	if adapter.iter.head == adapter.iter.tail && adapter.iter.reader != nil {
		if !adapter.iter.loadMore() {
			return io.EOF
		}
	}
	adapter.iter.ReadVal(obj)
	err := adapter.iter.Error
	if err == io.EOF {
		return nil
	}
	return adapter.iter.Error
}
1288481
func (dec *Decoder) Decode(pb proto.Message) error {
	buf, err := ioutil.ReadAll(dec.r)
	if err != nil {
		return err
	}

	return proto.Unmarshal(buf, pb)
}
1073634
func decode(data []byte) (*api.Config, error) {
	// if no data, return empty config
	if len(data) == 0 {
		return api.NewConfig(), nil
	}

	config, _, err := latest.Codec.Decode(data, nil, nil)
	if err != nil {
		return nil, errors.Wrapf(err, "Error decoding config from data: %s", string(data))
	}

	return config.(*api.Config), nil
}
769144
func (r *ReadState) Decode(reader io.ReadSeeker) error {
	return decode(r, reader)
}
1004650
func (e *Decoder) Decode(v interface{}) error {
	s, err := SliceFromReader(e.r)
	if err != nil {
		return WithStack(err)
	}
	if err := unmarshalSlice(s, v); err != nil {
		return WithStack(err)
	}
	return nil
}
1207794
func (o *OpenChannel) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		o.ChainHash[:],
		o.PendingChannelID[:],
		&o.FundingAmount,
		&o.PushAmount,
		&o.DustLimit,
		&o.MaxValueInFlight,
		&o.ChannelReserve,
		&o.HtlcMinimum,
		&o.FeePerKiloWeight,
		&o.CsvDelay,
		&o.MaxAcceptedHTLCs,
		&o.FundingKey,
		&o.RevocationPoint,
		&o.PaymentPoint,
		&o.DelayedPaymentPoint,
		&o.HtlcPoint,
		&o.FirstCommitmentPoint,
		&o.ChannelFlags,
	)
}
432388
func (list RequestCostList) decode() requestCostTable {
	table := make(requestCostTable)
	for _, e := range list {
		table[e.MsgCode] = &requestCosts{
			baseCost: e.BaseCost,
			reqCost:  e.ReqCost,
		}
	}
	return table
}
292332
func (e *encoding) decode(s string) uint64 {
	x := uint64(0)
	for i := 0; i < len(s); i++ {
		x = (x << 5) | uint64(e.dec[s[i]])
	}
	return x
}
892511
func (c *UpdateAddHTLC) Decode(r io.Reader, pver uint32) error {
	return ReadElements(r,
		&c.ChanID,
		&c.ID,
		&c.Amount,
		c.PaymentHash[:],
		&c.Expiry,
		c.OnionBlob[:],
	)
}
436117
func decodeBody(req *http.Request, out interface{}) error {
	dec := json.NewDecoder(req.Body)
	return dec.Decode(&out)
}
1005189
func (d *YAMLToJSONDecoder) Decode(into interface{}) error {
	if d.scanner.Scan() {
		data, err := yaml.YAMLToJSON(d.scanner.Bytes())
		if err != nil {
			return err
		}
		return json.Unmarshal(data, into)
	}
	err := d.scanner.Err()
	if err == nil {
		err = io.EOF
	}
	return err
}
500318
func decodeBody(resp *http.Response, out interface{}) error {

	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return err
	}

	// Unmarshal the XML.
	if err = xml.Unmarshal(body, &out); err != nil {
		return err
	}

	return nil
}
433866
func Decode(input interface{}, output interface{}) error {
	config := &DecoderConfig{
		Metadata: nil,
		Result:   output,
	}

	decoder, err := NewDecoder(config)
	if err != nil {
		return err
	}

	return decoder.Decode(input)
}