// EncoderDecoderFromString returns an encoders.EncoderDecoder from it's name.
355960
func EncoderDecoderFromString(str string) encoders.EncoderDecoder {
	var res encoders.EncoderDecoder
	switch str {
	case "gzip":
		res = &gzip.Gzip{}
	case "aes":
		res = &aes.AES{}
	case "openpgp":
		res = &openpgp.OpenPGP{}
	}
	return res
}
416096
func (r *Receipt) EncodeRLP(w io.Writer) error {
	return rlp.Encode(w, &receiptRLP{r.statusEncoding(), r.CumulativeGasUsed, r.Bloom, r.Logs})
}
662505
func encodeString(buf *bytes.Buffer, name string, val String) error {
	// type
	if err := buf.WriteByte(_STRING); err != nil {
		return err
	}

	// name
	if err := writeCstring(buf, name); err != nil {
		return err
	}

	// value
	return writeString(buf, string(val))
}
345234
func (enc *Encoding) EncodeToString(src []byte) string {
	buf := make([]byte, enc.EncodedLen(len(src)))
	enc.Encode(buf, src)
	return string(buf)
}
1362901
func (e *HeaderEncoder) encodeWord(s string) string {
	buf := bufFree.GetBuffer()
	defer bufFree.PutBuffer(buf)

	e.openWord(buf)

	switch {
	case e.encoding == B:
		e.encodeWordB(buf, s)
	default:
		e.encodeWordQ(buf, s)
	}

	e.closeWord(buf)
	return buf.String()
}
612389
func (e *Encoder) UseCompactEncoding(flag bool) *Encoder {
	e.useCompact = flag
	return e
}
1072829
func (f CodecFactory) EncoderForVersion(serializer runtime.Serializer, gv unversioned.GroupVersion) runtime.Encoder {
	return f.CodecForVersions(serializer, []unversioned.GroupVersion{gv}, nil)
}
352256
func ToString(data []byte) string {
	buf := bytes.NewBuffer(make([]byte, 0, 2+hex.EncodedLen(len(data))))
	// Leading NUL
	buf.WriteByte(0)
	buf.WriteString(hexencoding.EncodeToString(data))
	// Trailing NUL
	buf.WriteByte(0)
	return buf.String()
}
1230511
func (f CodecFactory) EncoderForVersion(encoder runtime.Encoder, gv runtime.GroupVersioner) runtime.Encoder {
	return f.CodecForVersions(encoder, nil, gv, nil)
}
405812
func IDFromString(str string) (*ID, error) {
	var id ID
	err := id.DecodeFromString(str)
	if err != nil {
		return nil, err
	}
	return &id, nil
}
388744
func (c *parameterCodec) EncodeParameters(obj Object, to schema.GroupVersion) (url.Values, error) {
	gvks, _, err := c.typer.ObjectKinds(obj)
	if err != nil {
		return nil, err
	}
	gvk := gvks[0]
	if to != gvk.GroupVersion() {
		out, err := c.convertor.ConvertToVersion(obj, to)
		if err != nil {
			return nil, err
		}
		obj = out
	}
	return queryparams.Convert(obj)
}
465335
func (m *MediaType) Encoder(w io.Writer) (Encoder, error) {
	if encfunc, ok := encoders[m.Format]; ok {
		return encfunc(w), nil
	}
	return nil, fmt.Errorf("No encoder found for format %s (%s)", m.Format, m.String())
}
504660
func marshalerEncoder(e *encodeState, v reflect.Value, opts encOpts) {
	if v.Kind() == reflect.Ptr && v.IsNil() {
		panic(fmt.Errorf("Cannot encode nil pointer"))
	}

	m, ok := v.Interface().(Marshaler)
	if !ok {
		panic(fmt.Errorf("Non-Marshaler passed to marshalerEncoder"))
	}

	b, err := m.MarshalTLS()
	if err == nil {
		_, err = e.Write(b)
	}

	if err != nil {
		panic(err)
	}
}
472529
func (p *Buffer) EncodeRawBytes(b []byte) error {
	p.EncodeVarint(uint64(len(b)))
	p.buf = append(p.buf, b...)
	return nil
}
753835
func Encode(value string) string {
	encoded := make([]byte, base64.URLEncoding.EncodedLen(len(value)))
	base64.URLEncoding.Encode(encoded, []byte(value))
	return string(encoded)
}
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()
}
851192
func encodeRefs(e *advRefsEncoder) encoderStateFn {
	for _, r := range e.sortedRefs {
		if r == e.firstRefName {
			continue
		}

		hash := e.data.References[r]
		if e.err = e.pe.Encodef("%s %s\n", hash.String(), r); e.err != nil {
			return nil
		}

		if hash, ok := e.data.Peeled[r]; ok {
			if e.err = e.pe.Encodef("%s %s^{}\n", hash.String(), r); e.err != nil {
				return nil
			}
		}
	}

	return encodeShallow
}