// WriteTo writes the trailer to w.
184473
func (t *IndexFileTrailer) WriteTo(w io.Writer) (n int64, err error) {
	// Write measurement block info.
	if err := writeUint64To(w, uint64(t.MeasurementBlock.Offset), &n); err != nil {
		return n, err
	} else if err := writeUint64To(w, uint64(t.MeasurementBlock.Size), &n); err != nil {
		return n, err
	}

	// Write series id set info.
	if err := writeUint64To(w, uint64(t.SeriesIDSet.Offset), &n); err != nil {
		return n, err
	} else if err := writeUint64To(w, uint64(t.SeriesIDSet.Size), &n); err != nil {
		return n, err
	}

	// Write tombstone series id set info.
	if err := writeUint64To(w, uint64(t.TombstoneSeriesIDSet.Offset), &n); err != nil {
		return n, err
	} else if err := writeUint64To(w, uint64(t.TombstoneSeriesIDSet.Size), &n); err != nil {
		return n, err
	}

	// Write legacy sketch info.
	for i := 0; i < 4; i++ {
		if err := writeUint64To(w, 0, &n); err != nil {
			return n, err
		}
	}

	// Write index file encoding version.
	if err := writeUint16To(w, IndexFileVersion, &n); err != nil {
		return n, err
	}

	return n, nil
}
433791
func (i *InstructionWriteActions) WriteTo(w io.Writer) (int64, error) {
	return writeInstructionActions(w, i.Type(), i.Actions)
}
783158
func (dec *declaration) WriteTo(w io.Writer) (int64, error) {
	return dec.writeTo(w, nil)
}
1072062
func (p POSTable) WriteTo(w io.Writer) (int64, error) {
	var b bytes.Buffer
	enc := gob.NewEncoder(&b)
	if err := enc.Encode(p.POSs); err != nil {
		return 0, err
	}
	if err := enc.Encode(p.NameList); err != nil {
		return 0, err
	}
	return b.WriteTo(w)
}
581282
func (v *variable) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write([]byte(v.value))

	return int64(n), err
}
282152
func (b *Bar) WriteTo(w io.Writer) (int64, error) {
	s := fmt.Sprintf("\r   %s ", b.String())
	_, err := io.WriteString(w, s)
	return int64(len(s)), err
}
560491
func WriteTo(buffers [][]*rfc5424.Message, w io.Writer) error {
	enc := gob.NewEncoder(w)
	return writeTo(buffers, enc)
}
194661
func (b *Builder) WriteTo(w io.Writer) (int64, error) {
	if !b.IsClosed() {
		return 0, WithStack(BuilderNotClosedError)
	}
	if n, err := w.Write(b.buf); err != nil {
		return 0, WithStack(err)
	} else {
		return int64(n), nil
	}
}
1158459
func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error) {
	b.Lock()
	defer b.Unlock()
	return b.b.WriteTo(w)
}
44778
func (f *FlowRemoved) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, f.Cookie, f.Priority, f.Reason,
		f.Table, f.DurationSec, f.DurationNSec, f.IdleTimeout,
		f.HardTimeout, f.PacketCount, f.ByteCount, &f.Match,
	)
}
100147
func (q *QueuePropMinRate) WriteTo(w io.Writer) (int64, error) {
	header := queueProp{q.Type(), queuePropLen}
	return encoding.WriteTo(w, header, pad4{}, q.Rate, pad6{})
}
1144240
func (p *PortMod) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, p.PortNo, pad4{}, p.HWAddr, pad2{},
		p.Config, p.Mask, p.Advertise, pad4{},
	)
}
550884
func (s *Store) WriteTo(w io.Writer) (n int64, err error) {
	s.mtx.RLock()
	defer s.mtx.RUnlock()

	return s.writeTo(w)
}
1276046
func (r *copyReader) WriteTo(w io.Writer) (int64, error) {
	if r.WriterTo == nil {
		return 0, nil
	}

	return r.WriterTo.WriteTo(w)
}
241591
func (t *MeasurementBlockTrailer) WriteTo(w io.Writer) (n int64, err error) {
	// Write data section info.
	if err := writeUint64To(w, uint64(t.Data.Offset), &n); err != nil {
		return n, err
	} else if err := writeUint64To(w, uint64(t.Data.Size), &n); err != nil {
		return n, err
	}

	// Write hash index section info.
	if err := writeUint64To(w, uint64(t.HashIndex.Offset), &n); err != nil {
		return n, err
	} else if err := writeUint64To(w, uint64(t.HashIndex.Size), &n); err != nil {
		return n, err
	}

	// Write legacy sketch info.
	for i := 0; i < 4; i++ {
		if err := writeUint64To(w, 0, &n); err != nil {
			return n, err
		}
	}

	// Write measurement block version.
	if err := writeUint16To(w, MeasurementBlockVersion, &n); err != nil {
		return n, err
	}

	return n, nil
}
19582
func (m *Image) WriteTo(w io.Writer) (int64, error) {
	return 0, png.Encode(w, m.Paletted)
}
988670
func (a *Actions) WriteTo(w io.Writer) (int64, error) {
	buf, err := a.bytes()
	if err != nil {
		return int64(len(buf)), err
	}

	return encoding.WriteTo(w, buf)
}