// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface
14210
func (b *bstream) UnmarshalBinary(bIn []byte) error {
	buf := bytes.NewReader(bIn)
	err := binary.Read(buf, binary.BigEndian, &b.count)
	if err != nil {
		return err
	}
	b.stream = make([]byte, buf.Len())
	return binary.Read(buf, binary.BigEndian, &b.stream)
}
586419
func (u *UUID) UnmarshalBinary(data []byte) (err error) {
	if len(data) != Size {
		err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data))
		return
	}
	copy(u[:], data)

	return
}
1223578
func (d *Date) UnmarshalBinary(data []byte) error {
	var t time.Time
	if err := t.UnmarshalBinary(data); err != nil {
		return err
	}
	*d = DateFromTime(t)
	return nil
}
621288
func (p *Property) UnmarshalBinary(data []byte) error {
	buf := bytes.NewBuffer(data)

	err := binary.Read(buf, binary.LittleEndian, &p.header)
	if err != nil {
		return err
	}

	switch p.header.Kind {
	case vixPropertyTypeBool:
		return binary.Read(buf, binary.LittleEndian, &p.data.Bool)
	case vixPropertyTypeInt32:
		return binary.Read(buf, binary.LittleEndian, &p.data.Int32)
	case vixPropertyTypeInt64:
		return binary.Read(buf, binary.LittleEndian, &p.data.Int64)
	case vixPropertyTypeString:
		s := make([]byte, p.header.Length)
		if _, err := buf.Read(s); err != nil {
			return err
		}

		p.data.String = string(bytes.TrimRight(s, "\x00"))
	case vixPropertyTypeBlob:
		p.data.Blob = make([]byte, p.header.Length)
		if _, err := buf.Read(p.data.Blob); err != nil {
			return err
		}
	default:
		return errors.New("VIX_E_UNRECOGNIZED_PROPERTY")
	}

	return nil
}
260689
func (e *EUI64) UnmarshalBinary(data []byte) error {
	if len(data) != len(e) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(e))
	}
	for i, v := range data {
		// little endian
		e[len(e)-i-1] = v
	}
	return nil
}
983675
func (im *Image) UnmarshalBinary(data []byte) error {
	dataCopy := make([]byte, len(data))
	copy(dataCopy, data)
	return im.UnmarshalBinaryNoCopy(dataCopy)
}
628695
func (i *IP) UnmarshalBinary(p []byte) error {
	if len(p) < net.IPv4len {
		return io.ErrUnexpectedEOF
	}

	*i = make([]byte, net.IPv4len)
	copy(*i, p[:net.IPv4len])
	return nil
}
1235638
func (n *NetID) UnmarshalBinary(data []byte) error {
	if len(data) != len(n) {
		return fmt.Errorf("lorawan: %d bytes of data are expected", len(n))
	}

	for i, v := range data {
		// little endian
		n[len(n)-1-i] = v
	}

	return nil
}
1366620
func (p *RXTimingSetupReqPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}
	p.Delay = data[0]
	return nil
}
97655
func (o *OptionCodes) UnmarshalBinary(p []byte) error {
	b := uio.NewBigEndianBuffer(p)
	*o = make(OptionCodes, 0, b.Len())
	for b.Has(1) {
		*o = append(*o, dhcp4.OptionCode(b.Read8()))
	}
	return b.FinError()
}
111633
func (po *Po) UnmarshalBinary(data []byte) error {
	buff := bytes.NewBuffer(data)
	obj := new(TranslatorEncoding)

	decoder := gob.NewDecoder(buff)
	err := decoder.Decode(obj)
	if err != nil {
		return err
	}

	po.Headers = obj.Headers
	po.Language = obj.Language
	po.PluralForms = obj.PluralForms
	po.nplurals = obj.Nplurals
	po.plural = obj.Plural
	po.translations = obj.Translations
	po.contexts = obj.Contexts

	if expr, err := plurals.Compile(po.plural); err == nil {
		po.pluralforms = expr
	}

	return nil
}
933631
func (dt *DateTime) UnmarshalBinary(data []byte) error {
	var t time.Time
	if err := t.UnmarshalBinary(data); err != nil {
		return err
	}
	*dt = DateTimeFromTime(t)
	return nil
}
189396
func (p *Preference) UnmarshalBinary(b []byte) error {
	if len(b) != 1 {
		return io.ErrUnexpectedEOF
	}

	*p = Preference(b[0])
	return nil
}
474980
func (v *Value) UnmarshalBinary(data []byte) error {
	reader := bytes.NewReader(data)

	b, err := reader.ReadByte()
	if err != nil {
		return err
	}

	typ := ValueType(b)
	if typ == NullType {
		*v = Value{}
		return nil
	}

	length, err := binary.ReadUvarint(reader)
	if err != nil {
		return err
	}

	raw := make([]byte, length)
	n, err := reader.Read(raw)
	if err != nil {
		return err
	}

	if uint64(n) != length {
		return errors.Newf("Not enough bytes to read Value")
	}

	switch typ {
	case NumericType:
		*v = Value{Numeric(raw)}
	case FractionalType:
		*v = Value{Fractional(raw)}
	case StringType:
		*v = Value{String{raw, false}}
	case UTF8StringType:
		*v = Value{String{raw, true}}
	default:
		return errors.Newf("Unknown type %d", int(typ))
	}

	return nil
}
135197
func (r *RequestGetattrV2) UnmarshalBinary(data []byte) error {
	return UnmarshalBinary(data, &r.Request, &r.AttrHint, &r.Handle, &r.FileName)
}
1354757
func (p *RXParamSetupAnsPayload) UnmarshalBinary(data []byte) error {
	if len(data) != 1 {
		return errors.New("lorawan: 1 byte of data is expected")
	}
	p.ChannelACK = data[0]&(1<<0) > 0
	p.RX2DataRateACK = data[0]&(1<<1) > 0
	p.RX1DROffsetACK = data[0]&(1<<2) > 0
	return nil
}
49440
func (r *RequestSetattrV2) UnmarshalBinary(data []byte) error {
	return UnmarshalBinary(data, &r.Request, &r.Hints, &r.Attr, &r.Handle, &r.FileName)
}