// jumpTo advances the reader to the amount of bytes provided
505070
func (d *Decoder) jumpTo(bytesAhead int) error {
	var err error
	if bytesAhead > 0 {
		_, err = d.r.Seek(int64(bytesAhead), io.SeekCurrent)
		// TODO: benchmark against
		// _, err = io.CopyN(ioutil.Discard, d.r, int64(bytesAhead))
	}
	return err
}
1018969
func (arr *ByteArray) WriteTo(w io.Writer) (n int64, err error) {
	var nn int64

	// Write length-prefix
	var length = types.Int32(len(arr.Value))
	nn, err = length.WriteTo(w)
	if err != nil {
		return
	}
	n += nn

	// Then write byte array
	for _, elem := range arr.Value {
		nn, err = elem.WriteTo(w)
		if err != nil {
			return
		}
		n += nn
	}

	return
}
1158459
func (b *ByteBuffer) WriteTo(w io.Writer) (int64, error) {
	b.Lock()
	defer b.Unlock()
	return b.b.WriteTo(w)
}
868050
func (ar *Reader) skipUnread() {
	nr := ar.nb // number of bytes to skip
	if ar.pad {
		nr += int64(1)
		ar.pad = false
	}
	ar.nb = 0
	if sr, ok := ar.r.(io.Seeker); ok {
		if _, err := sr.Seek(nr, os.SEEK_CUR); err == nil {
			return
		}
	}

	_, ar.err = io.CopyN(ioutil.Discard, ar.r, nr)
}
973761
func (conn *UDPConn) SendTo(addr net.Addr, p Packet) error {
	_, err := conn.WriteTo(p.Bytes(), addr)
	return err
}
592205
func (e *ErrorExperimenter) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, ErrTypeExperimenter, e.ExpType,
		e.Experimenter, e.Data)
}
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
}
1134628
func (b Blob) WriteTo(w io.Writer) (int64, error) {
	written, err := w.Write([]byte(b))
	return int64(written), err
}
971352
func (r *importReader) peekByte(skipSpace bool) byte {
	if r.err != nil {
		if r.nerr++; r.nerr > 10000 {
			panic("go/build: import reader looping")
		}
		return 0
	}

	// Use r.peek as first input byte.
	// Don't just return r.peek here: it might have been left by peekByte(false)
	// and this might be peekByte(true).
	c := r.peek
	if c == 0 {
		c = r.readByte()
	}
	for r.err == nil && !r.eof {
		if skipSpace {
			// For the purposes of this reader, semicolons are never necessary to
			// understand the input and are treated as spaces.
			switch c {
			case ' ', '\f', '\t', '\r', '\n', ';':
				c = r.readByte()
				continue

			case '/':
				c = r.readByte()
				if c == '/' {
					for c != '\n' && r.err == nil && !r.eof {
						c = r.readByte()
					}
				} else if c == '*' {
					var c1 byte
					for (c != '*' || c1 != '/') && r.err == nil {
						if r.eof {
							r.syntaxError()
						}
						c, c1 = c1, r.readByte()
					}
				} else {
					r.syntaxError()
				}
				c = r.readByte()
				continue
			}
		}
		break
	}
	r.peek = c
	return r.peek
}
966793
func (e *Entry) EncodeTo(w io.Writer) (n int64, err error) {

	defer func() {
		if r := recover(); r != nil {
			if e := r.(error); e != nil {
				err = e
			} else {
				panic(r)
			}
		}

	}()

	encoder := entryEncoder{}
	{
		var reserve [16]byte
		encoder.Header.Write(reserve[:])
	}
	encoder.Encoder = json.NewEncoder(&encoder.Header)
	if err = encoder.Encode(e); err != nil {
		return
	}

	{
		var padding [3]byte
		encoder.Header.Write(padding[:encoder.Header.Len()%4])
	}

	header := encoder.Header.Bytes()
	binary.LittleEndian.PutUint32(header[:4], 4)
	binary.LittleEndian.PutUint32(header[4:8], 8+uint32(encoder.Header.Len()))
	binary.LittleEndian.PutUint32(header[8:12], 4+uint32(encoder.Header.Len()))
	binary.LittleEndian.PutUint32(header[12:16], uint32(encoder.Header.Len()))

	n, err = encoder.Header.WriteTo(w)
	if err != nil {
		return
	}

	for _, chunk := range encoder.Contents {
		var written int64
		written, err = io.Copy(w, chunk)
		n += written
		if err != nil {
			return
		}
	}

	return
}
386628
func (p *PoolData) CopyTo(dstP *PoolData) error {
	dstP.ParentKey = p.ParentKey
	dstP.Pool = types.GetIPNetCopy(p.Pool)

	if p.Range != nil {
		dstP.Range = &AddressRange{}
		dstP.Range.Sub = types.GetIPNetCopy(p.Range.Sub)
		dstP.Range.Start = p.Range.Start
		dstP.Range.End = p.Range.End
	}

	dstP.RefCount = p.RefCount
	return nil
}
1004854
func (t textMapReaderWriter) CloneTo(w opentracing.TextMapWriter) {
	t.ForeachKey(func(k, v string) error {
		w.Set(k, v)
		return nil
	})
}
721233
func (h *Header) WriteTo(w io.Writer) (int64, error) {
	return encoding.WriteTo(w, *h)
}
1225067
func StreamTo(buffers [][]*rfc5424.Message, msgc <-chan *rfc5424.Message, w io.Writer) error {
	enc := gob.NewEncoder(w)
	if err := writeTo(buffers, enc); err != nil {
		return err
	}

	for msg := range msgc {
		if err := enc.Encode(msg); err != nil {
			return err
		}
	}
	return nil
}
491847
func (dasher *DashVertexConverter) MoveTo(x, y float64) {
	dasher.next.MoveTo(x, y)
	dasher.x, dasher.y = x, y
	dasher.distance = dasher.dashOffset
	dasher.currentDash = 0
}
550884
func (s *Store) WriteTo(w io.Writer) (n int64, err error) {
	s.mtx.RLock()
	defer s.mtx.RUnlock()

	return s.writeTo(w)
}
818115
func (e *Exportable) WriteTo(w io.Writer) (int64, error) {
	return e.buffer.WriteTo(w)
}