// WriteTo implements the io.WriterTo interface.
493312
func (u UnkDic) WriteTo(w io.Writer) (n int64, err error) {
	size, err := writeMap(w, u.UnkIndex)
	if err != nil {
		return n, err
	}
	n += size
	size, err = writeMap(w, u.UnkIndexDup)
	if err != nil {
		return n, err
	}
	n += size

	var buf bytes.Buffer
	enc := gob.NewEncoder(&buf)
	if err := enc.Encode(u.UnkMorphs); err != nil {
		return n, err
	}
	size, err = buf.WriteTo(w)
	if err != nil {
		return n, err
	}
	n += size
	if err := enc.Encode(u.UnkContents); err != nil {
		return n, err
	}
	size, err = buf.WriteTo(w)
	if err != nil {
		return n, err
	}
	n += size

	return n, nil
}
23832
func (model *Model) WriteTo(w io.Writer) (int64, error) {
	model.RLock()
	defer model.RUnlock()
	b, err := json.Marshal(model)
	if err != nil {
		return 0, err
	}
	n, err := w.Write(b)
	if err != nil {
		return int64(n), err
	}
	return int64(n), nil
}
1097085
func (f File) WriteTo(w io.Writer) (int64, error) {
	n, err := w.Write(f.data)
	if err == nil {
		if n != len(f.data) {
			// this shouldn't happen
			//
			//    Write must return a non-nil error if it returns n < len(p)
			//
			// but check just in case
			return int64(n), io.ErrShortWrite
		}
	}
	return int64(n), err
}
435060
func (between Between) WriteTo(w Writer) error {
	if _, err := fmt.Fprintf(w, "%s BETWEEN ? AND ?", w.Key(between.Col)); err != nil {
		return err
	}
	w.Append(between.LessVal, between.MoreVal)
	return nil
}
718676
func (c *Config) WriteTo(w io.Writer) (int64, error) {
	return 0, toml.NewEncoder(w).Encode(c)
}
1321204
func (t *TableMod) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, t.Table, pad3{}, t.Config)
}
1172198
func (sel *selector) WriteTo(w io.Writer) (int64, error) {
	return sel.writeTo(w, nil)
}
1108482
func (out *RAMOutputStream) WriteTo(output util.DataOutput) error {
	err := out.Flush()
	if err != nil {
		return err
	}
	end := out.file.length
	pos := int64(0)
	buffer := 0
	for pos < end {
		length := BUFFER_SIZE
		nextPos := pos + int64(length)
		if nextPos > end { // at the last buffer
			length = int(end - pos)
		}
		err = output.WriteBytes(out.file.Buffer(buffer)[:length])
		if err != nil {
			return err
		}
		buffer++
		pos = nextPos
	}
	return nil
}
249124
func (t *TablePropApplySetField) WriteTo(w io.Writer) (int64, error) {
	return writeTablePropXM(w, t, t.Fields)
}
269597
func (a *AsyncConfig) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, a.PacketInMask,
		a.PortStatusMask, a.FlowRemovedMask)
}
1158400
func (a *ActionCopyTTLOut) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, action{a.Type(), actionLen}, pad4{})
}
582459
func (notNull NotNull) WriteTo(w Writer) error {
	_, err := fmt.Fprintf(w, "%s IS NOT NULL", w.Key(notNull[0]))
	return err
}
19582
func (m *Image) WriteTo(w io.Writer) (int64, error) {
	return 0, png.Encode(w, m.Paletted)
}
350792
func (s Slice) WriteTo(w io.Writer) (n int64, err error) {
	nWrite, err := w.Write(s)
	return int64(nWrite), err
}
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)
}
1271831
func (c *Container) WriteTo(w io.Writer) (n int64, err error) {
	if c.isArray() {
		return c.arrayWriteTo(w)
	} else if c.isRun() {
		return c.runWriteTo(w)
	} else {
		return c.bitmapWriteTo(w)
	}
}
847139
func (e *Entity) WriteTo(w io.Writer) error {
	ew, err := CreateWriter(w, e.Header)
	if err != nil {
		return err
	}
	defer ew.Close()

	return e.writeBodyTo(ew)
}