// Encodef encodes a single pkt-line with the payload formatted as
// the format specifier. The rest of the arguments will be used in
// the format string.
167441
func (e *Encoder) Encodef(format string, a ...interface{}) error {
	return e.EncodeString(
		fmt.Sprintf(format, a...),
	)
}
977880
func (e *Encoder) EncodeString(payloads ...string) error {
	for _, p := range payloads {
		if err := e.Encode([]byte(p)); err != nil {
			return err
		}
	}

	return nil
}
195507
func Wrapf(err error, format string, a ...interface{}) error {
	if err == nil {
		return nil
	}
	return &wrapped{
		err: err,
		msg: fmt.Sprintf(format, a...),
	}
}
826712
func EncodeJSON(in interface{}) ([]byte, error) {
	if in == nil {
		return nil, fmt.Errorf("input for encoding is nil")
	}
	var buf bytes.Buffer
	enc := json.NewEncoder(&buf)
	if err := enc.Encode(in); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
969453
func (e StringEncoder) Encode(data interface{}, out *goetty.ByteBuf) error {
	msg, _ := data.(string)
	bytes := []byte(msg)
	out.WriteInt(len(bytes))
	out.Write(bytes)
	return nil
}
82569
func EncodeString(data string) string {
	return strings.Join([]string{strconv.Itoa(len(data)), data}, ":")
}
680075
func (r *ReferenceUpdateRequest) Encode(w io.Writer) error {
	if err := r.validate(); err != nil {
		return err
	}

	e := pktline.NewEncoder(w)

	if err := r.encodeShallow(e, r.Shallow); err != nil {
		return err
	}

	if err := r.encodeCommands(e, r.Commands, r.Capabilities); err != nil {
		return err
	}

	if r.Packfile != nil {
		if _, err := io.Copy(w, r.Packfile); err != nil {
			return err
		}

		return r.Packfile.Close()
	}

	return nil
}
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
}
414307
func Encode(src []byte) []byte {
	buf := make([]byte, Encoding.EncodedLen(len(src)))
	Encoding.Encode(buf, src)
	return buf
}
952805
func (e MsgPakEncoderDecoder) Encode(msgType uint8, version uint8, in interface{}) (*bytes.Buffer, error) {
	buf := bytes.NewBuffer(nil)
	buf.WriteByte(msgType)
	buf.WriteByte(version)
	handle := codec.MsgpackHandle{}
	encoder := codec.NewEncoder(buf, &handle)
	err := encoder.Encode(in)
	return buf, err
}
328542
func (encoder *IntLengthFieldBasedEncoder) Encode(data interface{}, out *ByteBuf) error {
	buf := NewByteBuf(32)

	if encoder.prepare != nil {
		err := encoder.prepare(data, out)
		if err != nil {
			return err
		}
	}

	err := encoder.base.Encode(data, buf)
	if err != nil {
		return err
	}

	out.WriteInt(buf.Readable())
	out.WriteByteBuf(buf)
	return nil
}
453323
func (f *FundingCreated) Encode(w io.Writer, pver uint32) error {
	return WriteElements(w, f.PendingChannelID[:], f.FundingPoint, f.CommitSig)
}
1343081
func encodeRange(x, r float64) uint32 {
	p := (x + r) / (2 * r)
	return uint32(p * exp232)
}
836090
func (b *Commit) Encode(o plumbing.EncodedObject) error {
	return b.encode(o, true)
}
979867
func (fs *FSObjects) encodePartFile(partNumber int, etag string, actualSize int64) string {
	return fmt.Sprintf("%.5d.%s.%d", partNumber, etag, actualSize)
}
573467
func (message Message) encode(encoder *gob.Encoder) {
	err := encoder.Encode(&message)
	if err != nil {
		Logln("Can't encode", err)
	}
}
790171
func (p *Buffer) EncodeMessage(pb Message) error {
	siz := Size(pb)
	p.EncodeVarint(uint64(siz))
	return p.Marshal(pb)
}