// ReadFrom implements io.ReadFrom interface. It deserializes the multipart
// experimenter header from the wire format.
191099
func (m *ExperimenterMultipartHeader) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &m.Experimenter, &m.ExpType)
}
1306353
func (i *VInt) ReadFrom(r Reader, l int) error {
	var v VInt
	b, err := r.ReadByte()
	if err != nil {
		return errorsp.WithStacks(err)
	}
	v = VInt(b & 0x7f)
	for n := uint(7); b&0x80 != 0; n += 7 {
		if b, err = r.ReadByte(); err != nil {
			if errorsp.Cause(err) == io.EOF {
				return errorsp.WithStacks(io.ErrUnexpectedEOF)
			}
			return errorsp.WithStacks(err)
		}
		v |= VInt(b&0x7f) << n
	}
	*i = v
	return nil
}
678926
func (p *PacketIn) ReadFrom(r io.Reader) (int64, error) {
	// Read the Packet-In header, list of match rules
	// that used to match the processing packet,
	// then the original frame, if any.
	n, err := encoding.ReadFrom(r, &p.Buffer, &p.Length,
		&p.Reason, &p.Table, &p.Cookie, &p.Match, &defaultPad2)
	if err != nil {
		return n, err
	}
	p.Data, err = ioutil.ReadAll(r)
	if err != nil {
		return n + int64(len(p.Data)), err
	}

	return n + int64(len(p.Data)), nil
}
380914
func (e *Error) ReadFrom(r io.Reader) (n int64, err error) {
	n, err = encoding.ReadFrom(r, &e.Type, &e.Code)
	if err != nil {
		return
	}

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

	return n + int64(len(e.Data)), nil
}
830467
func (m *MeterConfig) ReadFrom(r io.Reader) (int64, error) {
	var length uint16

	// Read the header of the message, so we could use
	// the rest of the reader to unmarshal list of bands.
	n, err := encoding.ReadFrom(r, &length, &m.Flags, &m.Meter)
	if err != nil {
		return n, err
	}

	// Use the rest of bytes to decode the bands.
	limrd := io.LimitReader(r, int64(length-meterConfigLen))
	nn, err := m.Bands.ReadFrom(limrd)
	return n + nn, err
}
14626
func (q *QueueStatsRequest) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &q.Port, &q.Queue)
}
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
}
140836
func (f *FlowStats) ReadFrom(r io.Reader) (int64, error) {
	var len uint16

	n, err := encoding.ReadFrom(r, &len, &f.Table, &defaultPad1,
		&f.DurationSec, &f.DurationNSec, &f.Priority, &f.IdleTimeout,
		&f.HardTimeout, &f.Flags, &defaultPad4, &f.Cookie, &f.PacketCount,
		&f.ByteCount, &f.Match)

	if err != nil {
		return n, err
	}

	limrd := io.LimitReader(r, int64(len)-n)
	f.Instructions = nil

	nn, err := f.Instructions.ReadFrom(limrd)
	return n + nn, err
}
665482
func (ac *arrayContainer) readFrom(stream io.Reader) (int, error) {
	buf := uint16SliceAsByteSlice(ac.content)
	return io.ReadFull(stream, buf)
}
1030878
func (i *Instructions) ReadFrom(r io.Reader) (n int64, err error) {
	var instType InstructionType

	rm := func() (io.ReaderFrom, error) {
		if rm, ok := instructionMap[instType]; ok {
			rd, err := rm.MakeReader()
			*i = append(*i, rd.(Instruction))
			return rd, err
		}

		return nil, fmt.Errorf("ofp: unknown instruction type: %s", instType)
	}

	return encoding.ScanFrom(r, &instType,
		encoding.ReaderMakerFunc(rm))
}
39471
func (a *ActionCopyTTLOut) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &defaultPad8)
}
539036
func (p *packetConn) ReadFrom(b []byte) (int, net.Addr, error) {
	return 0, nil, ErrNotImplemented
}
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
}
1006620
func (d *definition) readFrom(r io.Reader) error {
	err := binary.Read(r, binary.LittleEndian, d)
	if err != nil {
		return err
	}
	magic := reflect.TypeOf(*d).Field(0).Tag.Get("is")
	if !bytes.Equal(d.Magic[:], []byte(magic)) {
		return fmt.Errorf("cram: not a cram file: magic bytes %q", d.Magic)
	}
	return nil
}
1259968
func (m *MeterBandExperimenter) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &meterBand{}, &m.Rate,
		&m.BurstSize, &m.Experimenter)
}
791542
func (m *MultipartReply) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &m.Type, &m.Flags, &defaultPad4)
}
34900
func (g *GroupFeatures) ReadFrom(r io.Reader) (int64, error) {
	return encoding.ReadFrom(r, &g.Types, &g.Capabilities,
		&g.MaxGroups, &g.Actions)
}