// readFrom reads the header from an io.Reader
976377
func (h *DBHeader) readFrom(r io.Reader) error {
	// Save read data into a buffer that will be the RawData
	buffer := bytes.NewBuffer([]byte{})
	tR := io.TeeReader(r, buffer)

	// Read signature
	h.Signature = new(Signature)
	if err := binary.Read(tR, binary.LittleEndian, h.Signature); err != nil {
		return err
	}

	// Read file headers
	h.FileHeaders = new(FileHeaders)
	for {
		var err error
		if h.IsKdbx4() {
			err = h.FileHeaders.readHeader4(tR)
		} else {
			err = h.FileHeaders.readHeader31(tR)
		}

		// Update RawData buffer
		h.RawData = buffer.Bytes()

		if err != nil {
			if err == ErrEndOfHeaders {
				break
			}
			return err
		}
	}
	return nil
}
429902
func (p *Port) ReadFrom(r io.Reader) (int64, error) {
	p.HWAddr = make(net.HardwareAddr, 6)
	var name [portNameLen]byte

	n, err := encoding.ReadFrom(r, &p.PortNo, &defaultPad4, &p.HWAddr,
		&defaultPad2, &name, &p.Config, &p.State, &p.Curr, &p.Advertised,
		&p.Supported, &p.Peer, &p.CurrSpeed, &p.MaxSpeed,
	)

	p.Name = string(name[:])
	return n, err
}
1287339
func (t *Time) ReadFrom(r Reader, l int) error {
	var bytes ByteSlice
	if err := (&bytes).ReadFrom(r, l); err != nil {
		return errorsp.WithStacks(err)
	}
	return errorsp.WithStacks(((*time.Time)(t)).UnmarshalBinary(bytes))
}
335621
func (i *InstructionWriteMetadata) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &instruction{},
		&defaultPad4, &i.Metadata, &i.MetadataMask)
}
427710
func (q *QueuePropExperimenter) ReadFrom(r io.Reader) (int64, error) {
	var header queueProp
	n, err := encoding.ReadFrom(r, &header, &defaultPad4,
		&q.Experimenter, &defaultPad4)

	if err != nil {
		return n, err
	}

	limrd := io.LimitReader(r, int64(header.Len-queuePropLen))
	q.Data, err = ioutil.ReadAll(limrd)
	return n + int64(len(q.Data)), err
}
1372824
func (a *ActionSetNetworkTTL) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &defaultPad4, &a.TTL, &defaultPad3)
}
664432
func (q *QueueStats) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &q.Port, &q.Queue, &q.TxBytes,
		&q.TxPackets, &q.TxErrors, &q.DurationSec, &q.DurationNSec)
}
95918
func (b *Buffer) ReadFrom(r io.Reader) (int64, error) {
	version := b.preOp()
	n, err := b.buf.ReadFrom(r)
	b.postOp(version)
	return n, err
}
747262
func (a *AsyncConfig) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &a.PacketInMask,
		&a.PortStatusMask, &a.FlowRemovedMask)
}
935019
func (g *GroupDescStats) ReadFrom(r io.Reader) (int64, error) {
	var length uint16

	// Read the header of the messages to retrieve the
	// length of the buckets list.
	n, err := encoding.ReadFrom(r, &length, &g.Type,
		&defaultPad1, &g.Group)

	limrd := io.LimitReader(r, int64(length-groupDescStatsLen))
	bucketMaker := encoding.ReaderMakerOf(Bucket{})

	nn, err := encoding.ReadSliceFrom(limrd, bucketMaker, g.Buckets)
	return n + nn, err
}
224576
func (p *PortStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &p.PortNo, &defaultPad4)
}
526692
func (e *ErrorExperimenter) ReadFrom(r io.Reader) (n int64, err error) {
	var etype ErrType
	n, err = encoding.ReadFrom(r, &etype, &e.ExpType, &e.Experimenter)
	if err != nil {
		return n, err
	}

	e.Data, err = ioutil.ReadAll(r)
	if err != nil {
		return
	}

	return n + int64(len(e.Data)), nil
}
1321403
func (b *ByteBuffer) ReadFrom(r io.Reader) (int64, error) {
	p := b.B
	nStart := int64(len(p))
	nMax := int64(cap(p))
	n := nStart
	if nMax == 0 {
		nMax = 64
		p = make([]byte, nMax)
	} else {
		p = p[:nMax]
	}
	for {
		if n == nMax {
			nMax *= 2
			bNew := make([]byte, nMax)
			copy(bNew, p)
			p = bNew
		}
		nn, err := r.Read(p[n:])
		n += int64(nn)
		if err != nil {
			b.B = p[:n]
			n -= nStart
			if err == io.EOF {
				return n, nil
			}
			return n, err
		}
	}
}
1121381
func (g *GroupStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &g.Group, &defaultPad4)
}
149678
func (p *PacketOut) ReadFrom(r io.Reader) (int64, error) {
	var plen uint16

	n, err := encoding.ReadFrom(r, &p.Buffer, &p.InPort,
		&plen, &defaultPad6)

	if err != nil {
		return n, err
	}

	limrd := io.LimitReader(r, int64(plen))
	p.Actions = nil

	nn, err := p.Actions.ReadFrom(limrd)
	if n += nn; err != nil {
		return n, err
	}

	p.Data, err = ioutil.ReadAll(r)
	return n + int64(len(p.Data)), err
}
51530
func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) {
	deadline := c.readCancel()

	var addr tcpip.FullAddress
	read, err := commonRead(c.ep, c.wq, deadline, &addr, c, false)
	if err != nil {
		return 0, nil, err
	}

	return copy(b, read), fullToUDPAddr(addr), nil
}
39471
func (a *ActionCopyTTLOut) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &defaultPad8)
}