// Encode encode
495507
func (codec *StringCodec) Encode(data interface{}, out *ByteBuf) error {
	if msg, ok := data.(string); ok {
		return out.WriteString(msg)
	}

	return fmt.Errorf("not string: %+v", data)
}
99519
func (s GSM7) Encode() []byte {
    e := encoding.GSM7(false).NewEncoder()
    es, _, err := transform.Bytes(e, s)
    if err != nil {
        return s
    }
    return es
}
167309
func (o *OpenChannel) Encode(w io.Writer, pver uint32) error {
	return WriteElements(w,
		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,
	)
}
1223940
func (enc *Encoder) Encode(w io.Writer, nim image.Image, params imageserver.Params) error {
	e := &png.Encoder{CompressionLevel: enc.CompressionLevel}
	return e.Encode(w, nim)
}
1045788
func (resp *AppendEntriesResponse) Encode(w io.Writer) (int, error) {
	b, err := proto.Marshal(resp.pb)
	if err != nil {
		return -1, err
	}

	return w.Write(b)
}
718525
func (enc *Encoder) Encode(v interface{}) error {
	err := enc.p.marshalValue(reflect.ValueOf(v), nil, nil)
	if err != nil {
		return err
	}
	return enc.p.Flush()
}
1102564
func (jsonEncoder) Encode(v ...interface{}) string {
	var data interface{} = v
	if v == nil {
		// So that empty results produces `[]` and not `null`
		data = []interface{}{}
	} else if len(v) == 1 {
		data = v[0]
	}
	b, err := json.Marshal(data)
	if err != nil {
		panic(err)
	}
	log.Printf("%s", b)
	return string(b)
}
621200
func (enc *Encoder) Encode(pb proto.Message) error {
	buf, err := proto.Marshal(pb)
	if err != nil {
		return err
	}

	if _, err := enc.w.Write(buf); err != nil {
		return err
	}

	return nil
}
1205387
func (w *Stream) Encode(m JSONMessage) error {
	return w.enc.Encode(m)
}
934232
func (ci CellID) Encode(w io.Writer) error {
	e := &encoder{w: w}
	ci.encode(e)
	return e.err
}
256460
func (enc *Encoder) Encode(w io.Writer, nim image.Image, params imageserver.Params) error {
	opts, err := enc.getOptions(params)
	if err != nil {
		return err
	}
	return jpeg.Encode(w, nim, opts)
}
962452
func (e *encoder) Encode(obj runtime.Object) error {
	if err := e.encoder.Encode(obj, e.buf); err != nil {
		return err
	}
	_, err := e.writer.Write(e.buf.Bytes())
	e.buf.Reset()
	return err
}
704055
func (e *Encoder) Encode(v interface{}) error {
	f, ok := v.(marshalerFaster)
	if ok {
		e.buf.Reset()
		err := f.MarshalJSONBuf(&e.buf)
		if err != nil {
			return err
		}

		_, err = io.Copy(e.w, &e.buf)
		return err
	}

	return e.enc.Encode(v)
}
273495
func (f *Values) Encode() string {
	var buf bytes.Buffer
	for _, v := range f.values {
		if buf.Len() > 0 {
			buf.WriteByte('&')
		}
		buf.WriteString(url.QueryEscape(v.Key))
		buf.WriteString("=")
		buf.WriteString(url.QueryEscape(v.Value))
	}
	return buf.String()
}
69744
func Encode(charset int, utf_8 []byte) (latin []byte, success int, err error) {
	return converters[charset].Encode(utf_8)
}
1121315
func (c Cid) Encode(base mbase.Encoder) string {
	switch c.Version() {
	case 0:
		return c.Hash().B58String()
	case 1:
		return base.Encode(c.Bytes())
	default:
		panic("not possible to reach this point")
	}
}
1190473
func (s *scalarRange) encode(start, end []byte) (int, int) {
	n := utf8.EncodeRune(start, s.start)
	m := utf8.EncodeRune(end, s.end)
	return n, m
}