MCPcopy
hub / github.com/grpc/grpc-go / CopyTo

Method CopyTo

mem/buffer_slice.go:79–85  ·  view source on GitHub ↗

CopyTo copies each of the underlying Buffer's data into the given buffer, returning the number of bytes copied. Has the same semantics as the copy builtin in that it will copy as many bytes as it can, stopping when either dst is full or s runs out of data, returning the minimum of s.Len() and len(ds

(dst []byte)

Source from the content-addressed store, hash-verified

77// builtin in that it will copy as many bytes as it can, stopping when either dst
78// is full or s runs out of data, returning the minimum of s.Len() and len(dst).
79func (s BufferSlice) CopyTo(dst []byte) int {
80 off := 0
81 for _, b := range s {
82 off += copy(dst[off:], b.ReadOnlyData())
83 }
84 return off
85}
86
87// Materialize concatenates all the underlying Buffer's data into a single
88// contiguous buffer using CopyTo.

Callers 4

MaterializeMethod · 0.95
MaterializeToBufferMethod · 0.95
ReadMessageHeaderMethod · 0.80
readToMethod · 0.80

Calls 1

ReadOnlyDataMethod · 0.65

Tested by 2

ReadMessageHeaderMethod · 0.64
readToMethod · 0.64