func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) {

	// Write the bytes here.
	var buf = new(bytes.Buffer)

	// Write the bz without length-prefixing.
	bz, err := cdc.MarshalBinaryBare(o)
	if err != nil {
		return nil, err
	}

	// Write uvarint(len(bz)).
	err = EncodeUvarint(buf, uint64(len(bz)))
	if err != nil {
		return nil, err
	}

	// Write bz.
	_, err = buf.Write(bz)
	if err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
func (cdc *Codec) MarshalBinaryLengthPrefixed(o interface{}) ([]byte, error) {

	
	var buf = new(bytes.Buffer)

	
	bz, err := cdc.MarshalBinaryBare(o)
	if err != nil {
		return nil, err
	}

	
	err = EncodeUvarint(buf, uint64(len(bz)))
	if err != nil {
		return nil, err
	}

	
	_, err = buf.Write(bz)
	if err != nil {
		return nil, err
	}

	return buf.Bytes(), nil
}
func ( cdc * Codec ) MarshalBinaryLengthPrefixed ( o interface { } ) ( [ ] byte , error ) { // Write the bytes here. var buf = new ( bytes . Buffer ) // Write the bz without length-prefixing. bz , err := cdc . MarshalBinaryBare ( o ) if err != nil { return nil , err } // Write uvarint(len(bz)). err = EncodeUvarint ( buf , uint64 ( len ( bz ) ) ) if err != nil { return nil , err } // Write bz. _ , err = buf . Write ( bz ) if err != nil { return nil , err } return buf . Bytes ( ) , nil }
//----------------------------------------
// *Codec methods
// MarshalBinaryLengthPrefixed encodes the object o according to the Amino spec,
// but prefixed by a uvarint encoding of the object to encode.
// Use MarshalBinaryBare if you don't want byte-length prefixing.
//
// For consistency, MarshalBinaryLengthPrefixed will first dereference pointers
// before encoding.  MarshalBinaryLengthPrefixed will panic if o is a nil-pointer,
// or if o is invalid.
---------------------------------------- * Codec methods MarshalBinaryLengthPrefixed encodes the object o according to the Amino spec but prefixed by a uvarint encoding of the object to encode . Use MarshalBinaryBare if you don t want byte - length prefixing . For consistency MarshalBinaryLengthPrefixed will first dereference pointers before encoding . MarshalBinaryLengthPrefixed will panic if o is a nil - pointer or if o is invalid .