// dumpTo formats the Header and annotations for this renderedFrame.
505931
func (r *renderedFrame) dumpTo(w io.Writer, idx int) (n int, err error) {
	return iotools.WriteTracker(w, func(rawWriter io.Writer) error {
		w := &indented.Writer{Writer: rawWriter, UseSpaces: true}

		fmt.Fprintf(w, "#%d %s/%s:%d - %s()\n", idx, r.pkg, r.file,
			r.lineNum, r.funcName)
		w.Level += 2
		switch len(r.annotations) {
		case 0:
			// pass
		case 1:
			for _, line := range r.annotations[0] {
				fmt.Fprintf(w, "%s\n", line)
			}
		default:
			for i, ann := range r.annotations {
				fmt.Fprintf(w, "annotation #%d:\n", i)
				w.Level += 2
				for _, line := range ann {
					fmt.Fprintf(w, "%s\n", line)
				}
				w.Level -= 2
			}
		}
		return nil
	})
}
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,
	)
}
504758
func (hdr *SeriesIndexHeader) WriteTo(w io.Writer) (n int64, err error) {
	var buf bytes.Buffer
	buf.WriteString(SeriesIndexMagic)
	binary.Write(&buf, binary.BigEndian, hdr.Version)
	binary.Write(&buf, binary.BigEndian, hdr.MaxSeriesID)
	binary.Write(&buf, binary.BigEndian, hdr.MaxOffset)
	binary.Write(&buf, binary.BigEndian, hdr.Count)
	binary.Write(&buf, binary.BigEndian, hdr.Capacity)
	binary.Write(&buf, binary.BigEndian, hdr.KeyIDMap.Offset)
	binary.Write(&buf, binary.BigEndian, hdr.KeyIDMap.Size)
	binary.Write(&buf, binary.BigEndian, hdr.IDOffsetMap.Offset)
	binary.Write(&buf, binary.BigEndian, hdr.IDOffsetMap.Size)
	return buf.WriteTo(w)
}
1167732
func (f *Fixed) SerializeTo(w io.Writer) error {
	_, err := w.Write(f.Bytes())
	return err
}
445688
func (c Client) dumpHTTP(req *http.Request, resp *http.Response) error {
	// Starts http dump.
	_, err := fmt.Fprintln(c.traceOutput, "---------START-HTTP---------")
	if err != nil {
		return err
	}

	// Filter out Signature field from Authorization header.
	origAuth := req.Header.Get("Authorization")
	if origAuth != "" {
		req.Header.Set("Authorization", redactSignature(origAuth))
	}

	// Only display request header.
	reqTrace, err := httputil.DumpRequestOut(req, false)
	if err != nil {
		return err
	}

	// Write request to trace output.
	_, err = fmt.Fprint(c.traceOutput, string(reqTrace))
	if err != nil {
		return err
	}

	// Only display response header.
	var respTrace []byte

	// For errors we make sure to dump response body as well.
	if resp.StatusCode != http.StatusOK &&
		resp.StatusCode != http.StatusPartialContent &&
		resp.StatusCode != http.StatusNoContent {
		respTrace, err = httputil.DumpResponse(resp, true)
		if err != nil {
			return err
		}
	} else {
		respTrace, err = httputil.DumpResponse(resp, false)
		if err != nil {
			return err
		}
	}

	// Write response to trace output.
	_, err = fmt.Fprint(c.traceOutput, strings.TrimSuffix(string(respTrace), "\r\n"))
	if err != nil {
		return err
	}

	// Ends the http dump.
	_, err = fmt.Fprintln(c.traceOutput, "---------END-HTTP---------")
	if err != nil {
		return err
	}

	// Returns success.
	return nil
}
75773
func (e *Error) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, e.Type, e.Code, e.Data)
}
1250133
func (t *TablePropNextTables) WriteTo(w io.Writer) (int64, error) {
	headerlen := tablePropLen + len(t.NextTables)
	header := tableProp{t.Type(), uint16(headerlen)}

	padding := makePad(headerlen)
	return encoding.WriteTo(w, header, t.NextTables, padding)
}
1321204
func (t *TableMod) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, t.Table, pad3{}, t.Config)
}
840020
func (b *Buffer) DumpTo(w io.Writer) (written int, err error) {
	var n int
	for _, buf := range b.bufs {
		if err == nil {
			n, err = w.Write(buf)
			written += n
		}
		putBuf(buf)
	}

	if err == nil {
		n, err = w.Write(b.Buf)
		written += n
	}
	putBuf(b.toPool)

	b.bufs = nil
	b.Buf = nil
	b.toPool = nil

	return
}
1112139
func (s *BufferStore) SaveTo(m Mutator) error {
	err := s.WalkBuffer(func(k Key, v []byte) error {
		if len(v) == 0 {
			return m.Delete(k)
		}
		return m.Set(k, v)
	})
	return err
}
536559
func (engine *Engine) DumpAll(w io.Writer, tp ...core.DbType) error {
	tables, err := engine.DBMetas()
	if err != nil {
		return err
	}
	return engine.DumpTables(tables, w, tp...)
}
1272320
func (udhl *UDHList) SerializeTo(w io.Writer) error {
	_, err := w.Write(udhl.Bytes())
	return err
}
1182347
func (h *Header) SerializeTo(w io.Writer) error {
	b := make([]byte, HeaderLen)
	binary.BigEndian.PutUint32(b[0:4], h.Len)
	binary.BigEndian.PutUint32(b[4:8], uint32(h.ID))
	binary.BigEndian.PutUint32(b[8:12], uint32(h.Status))
	binary.BigEndian.PutUint32(b[12:16], h.Seq)
	_, err := w.Write(b)
	return err
}
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
}
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)
}
721233
func (h *Header) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, *h)
}
647484
func (h *DBHeader) writeTo(w io.Writer) error {
	var buffer bytes.Buffer
	mw := io.MultiWriter(w, &buffer)

	binary.Write(mw, binary.LittleEndian, h.Signature)

	if h.IsKdbx4() {
		h.FileHeaders.writeTo4(mw, &buffer)
	} else {
		h.FileHeaders.writeTo31(mw)
	}

	h.RawData = buffer.Bytes()

	return nil
}