// WriteTo implements io.WriterTo interface. It serializes the
// experimental queue property into the wire format.
488309
func (q *QueuePropExperimenter) WriteTo(w io.Writer) (int64, error) {
	header := queueProp{q.Type(), queuePropLen + uint16(len(q.Data))}
	return encoding.WriteTo(w, header, pad4{},
		q.Experimenter, &pad4{}, q.Data)
}
125177
func (i Int) WriteTo(w io.Writer) (int64, error) {
	written, err := fmt.Fprintf(w, "%d", i)
	return int64(written), err
}
614939
func (q *QueueGetConfigReply) WriteTo(w io.Writer) (int64, error) {
	var buf bytes.Buffer
	for _, queue := range q.Queues {
		_, err := queue.WriteTo(&buf)
		if err != nil {
			return 0, err
		}
	}

	return encoding.WriteTo(w, q.Port, pad4{}, buf.Bytes())
}
1321291
func (i *InstructionGotoTable) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, instruction{i.Type(), 8}, i.Table, pad3{})
}
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
}
721233
func (h *Header) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, *h)
}
860708
func (b Bool) WriteTo(w io.Writer) (int64, error) {
	written, err := fmt.Fprintf(w, "%t", b)
	return int64(written), err
}
765087
func (s *Chan) WriteTo(w io.Writer) {
	// new buffer per message
	// if bottleneck, cycle around a set of buffers
	mw := NewWriter(w)

	// single writer, no need for Mutex
	mw.(*writer).lock = new(nullLocker)
Loop:
	for {
		select {
		case <-s.CloseChan:
			break Loop // told we're done

		case msg, ok := <-s.MsgChan:
			if !ok { // chan closed
				break Loop
			}

			if err := mw.WriteMsg(msg); err != nil {
				if err != io.EOF {
					// unexpected error. tell the client.
					s.ErrChan <- err
				}

				break Loop
			}
		}
	}

	// signal we're done
	s.CloseChan <- true
}
402556
func (t *TablePropApplyActions) WriteTo(w io.Writer) (int64, error) {
	return writeTablePropActions(w, t, t.Actions)
}
1232903
func (q QueueProps) WriteTo(w io.Writer) (int64, error) {
	var buf bytes.Buffer

	for _, prop := range q {
		_, err := prop.WriteTo(&buf)
		if err != nil {
			return 0, err
		}
	}

	return encoding.WriteTo(w, buf.Bytes())
}
224622
func (m *MeterBandExperimenter) WriteTo(w io.Writer) (int64, error) {
	header := meterBand{m.Type(), meterBandLen}
	return encoding.WriteTo(w, header, m.Rate,
		m.BurstSize, m.Experimenter)
}
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
}
32201
func (b *base) WriteTo(w io.Writer) (int64, error) {
	// Create a byte buffer.
	var bf bytes.Buffer

	// Write the Packet data to the buffer.
	bf.Write(b.fixedHeader)
	bf.Write(b.variableHeader)
	bf.Write(b.payload)

	// Write the buffered data to the writer.
	n, err := w.Write(bf.Bytes())

	// Return the result.
	return int64(n), err
}
831337
func (r *Reader) WriteTo(w io.Writer) (int64, error) {
	var (
		i   int64
		ii  int
		err error
	)
	// first, clear buffer
	if r.buffered() > 0 {
		ii, err = w.Write(r.data[r.n:])
		i += int64(ii)
		if err != nil {
			return i, err
		}
		r.data = r.data[0:0]
		r.n = 0
	}
	for r.state == nil {
		// here we just do
		// 1:1 reads and writes
		r.more()
		if r.buffered() > 0 {
			ii, err = w.Write(r.data)
			i += int64(ii)
			if err != nil {
				return i, err
			}
			r.data = r.data[0:0]
			r.n = 0
		}
	}
	if r.state != io.EOF {
		return i, r.err()
	}
	return i, nil
}
728914
func (ini *INI) WriteTo(w io.Writer) (int64, error) {
	var written int64

	// Global section.
	m, err := ini.printSection(w, &ini.global)
	written += int64(m)
	if err != nil {
		return written, err
	}
	first := len(ini.global.Data) > 0

	for i, section := range ini.sections {
		if i > 0 || first {
			m, err := fmt.Fprintf(w, "\n")
			written += int64(m)
			if err != nil {
				return written, err
			}
		}
		m, err := ini.printSection(w, section)
		written += int64(m)
		if err != nil {
			return written, err
		}
	}

	return written, nil
}
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)
}
985539
func (not Not) WriteTo(w Writer) error {
	if _, err := fmt.Fprint(w, "NOT "); err != nil {
		return err
	}
	switch not[0].(type) {
	case condAnd, condOr:
		if _, err := fmt.Fprint(w, "("); err != nil {
			return err
		}
	case Eq:
		if len(not[0].(Eq)) > 1 {
			if _, err := fmt.Fprint(w, "("); err != nil {
				return err
			}
		}
	case Neq:
		if len(not[0].(Neq)) > 1 {
			if _, err := fmt.Fprint(w, "("); err != nil {
				return err
			}
		}
	}

	if err := not[0].WriteTo(w); err != nil {
		return err
	}

	switch not[0].(type) {
	case condAnd, condOr:
		if _, err := fmt.Fprint(w, ")"); err != nil {
			return err
		}
	case Eq:
		if len(not[0].(Eq)) > 1 {
			if _, err := fmt.Fprint(w, ")"); err != nil {
				return err
			}
		}
	case Neq:
		if len(not[0].(Neq)) > 1 {
			if _, err := fmt.Fprint(w, ")"); err != nil {
				return err
			}
		}
	}

	return nil
}