// Encode returns the ber packet representation
2803
func (c *ControlManageDsaIT) Encode() *ber.Packet {
	//FIXME
	packet := ber.Encode(ber.ClassUniversal, ber.TypeConstructed, ber.TagSequence, nil, "Control")
	packet.AppendChild(ber.NewString(ber.ClassUniversal, ber.TypePrimitive, ber.TagOctetString, ControlTypeManageDsaIT, "Control Type ("+ControlTypeMap[ControlTypeManageDsaIT]+")"))
	if c.Criticality {
		packet.AppendChild(ber.NewBoolean(ber.ClassUniversal, ber.TypePrimitive, ber.TagBoolean, c.Criticality, "Criticality"))
	}
	return packet
}
1030255
func (e *Error) Encode(w io.Writer, prver uint32) error {
	return WriteElements(w,
		e.Code,
		e.Data,
	)
}
1009454
func encode(i interface{}, w http.ResponseWriter) {
	w.Header().Add("Content-Type", "application/json")

	enc := json.NewEncoder(w)
	err := enc.Encode(i)
	// Problems encoding
	if err != nil {
		LoggingClient.Error("Error encoding the data: " + err.Error())
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
}
772941
func encode(bin []byte) []byte {
	e64 := base64.StdEncoding

	maxEncLen := e64.EncodedLen(len(bin))
	encBuf := make([]byte, maxEncLen)

	e64.Encode(encBuf, bin)
	return encBuf
}
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)
}
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)
}
751059
func (b binaryEncoderDecoder) Encode(v interface{}) ([]byte, error) {
	buf := bytes.NewBuffer([]byte{})
	enc := gob.NewEncoder(buf)
	if err := enc.Encode(v); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
1224457
func (enc *encoder) Encode(vs ...interface{}) (err error) {
	defer func() {
		err, _ = recover().(error)
	}()
	for _, v := range vs {
		enc.encode(reflect.ValueOf(v), 0)
	}
	return nil
}
1073569
func (pl *Payload) Encode() ([]byte, error) {
	// Note that this method can't be named MarshalBinary, because the gob encoder would call
	// this method, resulting in infinite recursion.
	var buf bytes.Buffer
	if err := pl.WriteBinary(&buf); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
286475
func (pp *Pingreq) Encode(dst []byte) (int, error) {
	return nakedEncode(dst, PINGREQ)
}
539982
func (e *HeaderEncoder) Encode(s string) string {
	if !needsEncoding(s) {
		return s
	}

	return e.encodeWord(s)
}
596242
func (pp *Pingresp) Encode(dst []byte) (int, error) {
	return nakedEncode(dst, PINGRESP)
}
58961
func (e Encoder) Encode(iVal interface{}) error {

	err := e.encode(iVal)
	if err != nil {
		return err
	}

	// Whatever is left in the buffer for the chunk at the end, write it out
	return e.flush()
}
1186353
func (g GobEncoder) Encode(v interface{}) ([]byte, error) {
	var buf bytes.Buffer
	e := gob.NewEncoder(&buf)
	err := e.Encode(v)
	return buf.Bytes(), err
}
711322
func (v BoolValue) encode(w io.Writer) error {
	return binary.Write(w, binary.BigEndian, v.valueType())
}
45463
func encode(data interface{}) ([]byte, error) {
	if data == nil {
		return nil, nil
	}
	buf := bytes.NewBuffer([]byte{})
	enc := gob.NewEncoder(buf)
	if err := enc.Encode(data); err != nil {
		return nil, err
	}
	return buf.Bytes(), nil
}
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)
}