// WriteTo saves a double array.
979587
func (d DoubleArray) WriteTo(w io.Writer) (n int64, err error) {
	sz := int64(len(d))
	//fmt.Println("write data len:", sz)
	if err = binary.Write(w, binary.LittleEndian, sz); err != nil {
		return
	}
	n += int64(binary.Size(sz))
	for _, v := range d {
		if err = binary.Write(w, binary.LittleEndian, v.Base); err != nil {
			return
		}
		n += int64(binary.Size(v.Base))
		if err = binary.Write(w, binary.LittleEndian, v.Check); err != nil {
			return
		}
		n += int64(binary.Size(v.Check))
	}
	return
}
403342
func (s *SwitchFeatures) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w,
		s.DatapathID, s.NumBuffers, s.NumTables, s.AuxiliaryID,
		pad2{}, s.Capabilities, s.Reserved)
}
505377
func (b *BitSet) WriteTo(stream io.Writer) (int64, error) {
	length := uint64(b.length)

	// Write length
	err := binary.Write(stream, binaryOrder, length)
	if err != nil {
		return 0, err
	}

	// Write set
	err = binary.Write(stream, binaryOrder, b.set)
	return int64(b.BinaryStorageSize()), 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
}
1358800
func (c Contents) WriteTo(w io.Writer) (n int64, err error) {
	for i := 0; i < len(c)-1; i++ {
		x, e := fmt.Fprintf(w, "%s%s", strings.Join(c[i], colDelimiter), rowDelimiter)
		if e != nil {
			return
		}
		n += int64(x)
	}
	if i := len(c) - 1; i > 0 {
		x, e := fmt.Fprintf(w, "%s", strings.Join(c[i], colDelimiter))
		if e != nil {
			return n, e
		}
		n += int64(x)
	}
	return
}
592205
func (e *ErrorExperimenter) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, ErrTypeExperimenter, e.ExpType,
		e.Experimenter, e.Data)
}
860555
func (i RawVInt) WriteTo(w Writer) error {
	var arr [8]byte
	n := 0
	for i != 0 {
		arr[n] = byte(i & 0xff)
		n++
		i >>= 8
	}
	_, err := w.Write(arr[:n])
	return errorsp.WithStacks(err)
}
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)
}
1148670
func (c *Command) WriteTo(w io.Writer) (int64, error) {
	var total int64
	var buf [4]byte

	n, err := w.Write(c.Name)
	total += int64(n)
	if err != nil {
		return total, err
	}

	for _, param := range c.Params {
		n, err := w.Write(byteSpace)
		total += int64(n)
		if err != nil {
			return total, err
		}
		n, err = w.Write(param)
		total += int64(n)
		if err != nil {
			return total, err
		}
	}

	n, err = w.Write(byteNewLine)
	total += int64(n)
	if err != nil {
		return total, err
	}

	if c.Body != nil {
		bufs := buf[:]
		binary.BigEndian.PutUint32(bufs, uint32(len(c.Body)))
		n, err := w.Write(bufs)
		total += int64(n)
		if err != nil {
			return total, err
		}
		n, err = w.Write(c.Body)
		total += int64(n)
		if err != nil {
			return total, err
		}
	}

	return total, nil
}
1121858
func (m *MultipartReply) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, *m, pad4{})
}
191464
func (dec *declaration) writeTo(w io.Writer, params map[string]string) (int64, error) {
	bf := new(bytes.Buffer)

	bf.WriteString(dec.property)
	bf.WriteString(colon)

	for i, v := range strings.Split(dec.value, space) {
		if i > 0 {
			bf.WriteString(space)
		}

		for j, w := range strings.Split(v, comma) {
			if j > 0 {
				bf.WriteString(comma)
			}

			if strings.HasPrefix(w, dollarMark) {
				// Writing to the bytes.Buffer never returns an error.
				dec.writeParamTo(bf, strings.TrimPrefix(w, dollarMark), params)
			} else {
				bf.WriteString(w)
			}
		}
	}

	bf.WriteString(semicolon)

	n, err := w.Write(bf.Bytes())

	return int64(n), err
}
712833
func (s *BytesStore) writeTo(out util.DataOutput) error {
	for _, block := range s.blocks {
		err := out.WriteBytes(block)
		if err != nil {
			return err
		}
	}
	return nil
}
678153
func (ba RawByteSlice) WriteTo(w Writer) error {
	_, err := w.Write(ba)
	return errorsp.WithStacks(err)
}
1360615
func (r *AccessLogRecord) WriteTo(w io.Writer) (int64, error) {
	bytesWritten, err := w.Write(r.getRecord())
	return int64(bytesWritten), err
}
665616
func (row Row) WriteTo(writer io.Writer) (err error) {
	encoded, err := encodeRow(row)
	if err != nil {
		return fmt.Errorf("WriteTo encoding error: %v", err)
	}
	return WriteMessage(writer, encoded)
}
882203
func (t *Tree) WriteTo(w io.Writer) (int64, error) {
	return t.writeTo(w, "", "", 0, false)
}
19582
func (m *Image) WriteTo(w io.Writer) (int64, error) {
	return 0, png.Encode(w, m.Paletted)
}