// addBinary adds a binary value to the buffer.
761327
func (b *Builder) addBinary(v []byte) {
	l := uint(len(v))
	b.buf.ReserveSpace(1 + 8 + l)
	b.appendUInt(uint64(l), 0xbf) // data length
	b.buf.Write(v)                // data
}
250268
func (bh *Header) MarshalBinary() ([]byte, error) {
	b := &bytes.Buffer{}
	err := bh.EncodeBinary(b)
	if err != nil {
		return nil, err
	}
	return b.Bytes(), nil
}
441299
func (o Options) MarshalBinary() ([]byte, error) {
	b := buffer.New(nil)
	for _, code := range o.sortedCodes() {
		for _, data := range o[code] {
			// 2 bytes: option code
			b.Write16(uint16(code))

			// 2 bytes: option length
			b.Write16(uint16(len(data)))

			// N bytes: option data
			b.WriteBytes(data)
		}
	}
	return b.Data(), nil
}
266486
func (e EUI64) MarshalBinary() ([]byte, error) {
	out := make([]byte, len(e))
	// little endian
	for i, v := range e {
		out[len(e)-i-1] = v
	}
	return out, nil
}
1122835
func (meta *Meta) ReadBinary(r io.Reader) error {
	return binary.Read(r, byteorder.Native, meta)
}
406699
func (r *RequestCreateSessionV4) MarshalBinary() ([]byte, error) {
	buf := new(bytes.Buffer)

	r.NumCapabilities = uint32(len(r.Capabilities))

	fields := []*uint32{
		&r.NumCapabilities,
		&r.MaxPacketSize,
		&r.Flags,
		&r.Reserved,
	}

	for _, p := range fields {
		err := binary.Write(buf, binary.LittleEndian, p)
		if err != nil {
			return nil, err
		}
	}

	for i := uint32(0); i < r.NumCapabilities; i++ {
		err := binary.Write(buf, binary.LittleEndian, &r.Capabilities[i])
		if err != nil {
			return nil, err
		}
	}

	return buf.Bytes(), nil
}
374066
func MarshalBinary(fields ...interface{}) ([]byte, error) {
	buf := new(bytes.Buffer)

	for _, p := range fields {
		switch m := p.(type) {
		case encoding.BinaryMarshaler:
			data, err := m.MarshalBinary()
			if err != nil {
				return nil, ProtocolError(err)
			}

			_, _ = buf.Write(data)
		case []byte:
			_, _ = buf.Write(m)
		case string:
			_, _ = buf.WriteString(m)
		default:
			err := binary.Write(buf, binary.LittleEndian, p)
			if err != nil {
				return nil, ProtocolError(err)
			}
		}
	}

	return buf.Bytes(), nil
}
1275134
func (p PackageVersionAnsPayload) MarshalBinary() ([]byte, error) {
	return []byte{
		p.PackageIdentifier,
		p.PackageVersion,
	}, nil
}
579126
func (m *SwaggerJSONWebKeySet) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
963523
func AsBinary(c aspect.ColumnElem) aspect.ColumnElem {
	return c.SetInner(
		aspect.FuncClause{Inner: c.Inner(), F: "ST_AsBinary"},
	)
}
637775
func (v *VLAN) MarshalBinary() ([]byte, error) {
	b := make([]byte, 2)
	_, err := v.read(b)
	return b, err
}
1029805
func (p DeviceModeConfPayload) MarshalBinary() ([]byte, error) {
	return []byte{byte(p.Class)}, nil
}
894892
func (m *SwaggerVersion) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
844484
func (m *Service) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
134736
func (m *ExtUser) MarshalBinary() ([]byte, error) {
	if m == nil {
		return nil, nil
	}
	return swag.WriteJSON(m)
}
672604
func (b *BitSet) MarshalBinary() ([]byte, error) {
	var buf bytes.Buffer
	writer := bufio.NewWriter(&buf)

	_, err := b.WriteTo(writer)
	if err != nil {
		return []byte{}, err
	}

	err = writer.Flush()

	return buf.Bytes(), err
}
816011
func (f *Frame) MarshalBinary() ([]byte, error) {
	b := make([]byte, f.length())
	_, err := f.read(b)
	return b, err
}