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

Function NewWrapReader

wrapio/wrap.go:75–83  ·  view source on GitHub ↗

NewWrapReader creates a WrapReader starting at offset off, and wrapping at offset wrapAt.

(r io.ReaderAt, off int64, wrapAt int64)

Source from the content-addressed store, hash-verified

73
74// NewWrapReader creates a WrapReader starting at offset off, and wrapping at offset wrapAt.
75func NewWrapReader(r io.ReaderAt, off int64, wrapAt int64) *WrapReader {
76 return &WrapReader{
77 &wrapper{
78 doat: r.ReadAt,
79 off: (off % wrapAt),
80 wrapAt: wrapAt,
81 },
82 }
83}
84
85// Read reads into p starting at the current offset, wrapping if it reaches the end.
86// The current offset is shifted forward by the amount read.

Callers 4

NewRingFunction · 0.92
ResetMethod · 0.92
TestWrapFunction · 0.85
ReadAtMethod · 0.85

Calls

no outgoing calls

Tested by 1

TestWrapFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…