MCPcopy Create free account
hub / github.com/djherbis/buffer / NewMultiAt

Function NewMultiAt

multi.go:36–51  ·  view source on GitHub ↗

NewMultiAt returns a BufferAt which is the logical concatenation of the passed BufferAts. The data in the buffers is shifted such that there is no non-empty buffer following a non-full buffer, this process is also run after every Read. If no buffers are passed, the returned Buffer is nil.

(buffers ...BufferAt)

Source from the content-addressed store, hash-verified

34// a non-full buffer, this process is also run after every Read.
35// If no buffers are passed, the returned Buffer is nil.
36func NewMultiAt(buffers ...BufferAt) BufferAt {
37 if len(buffers) == 0 {
38 return nil
39 } else if len(buffers) == 1 {
40 return buffers[0]
41 }
42
43 buf := &chain{
44 Buf: buffers[0],
45 Next: NewMultiAt(buffers[1:]...),
46 }
47
48 buf.Defrag()
49
50 return buf
51}
52
53// NewMulti returns a Buffer which is the logical concatenation of the passed buffers.
54// The data in the buffers is shifted such that there is no non-empty buffer following

Callers 2

TestWriteAtFunction · 0.85
NewMultiFunction · 0.85

Calls 1

DefragMethod · 0.95

Tested by 1

TestWriteAtFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…