func()

in serialize.go [89:122]


func (qf *Filter) ReadFrom(stream io.Reader) (i int64, err error) {
	var h QFHeader
	if err = binary.Read(stream, binary.LittleEndian, &h); err != nil {
		return
	}
	i += int64(unsafe.Sizeof(h))
	if h.Version != qfVersion {
		return i, fmt.Errorf("incompatible file format: version is %d, expected %d",
			h.Version, qfVersion)
	}
	qf.entries = h.Entries
	qf.initForQuotientBits(uint(h.QBits))
	n, err := qf.filter.ReadFrom(stream)
	i += n
	if err != nil {
		return
	}

	// read bits

	if h.StorageBits > 0 {
		qf.config.BitsOfStoragePerEntry = uint(h.StorageBits)
		if qf.storage == nil {
			qf.storage = qf.allocfn(0, 0)
		}
		n, err = qf.storage.ReadFrom(stream)
		i += n
		if err != nil {
			return
		}
	}

	return
}