MCPcopy
hub / github.com/pquerna/ffjson / Next

Method Next

fflib/v1/buffer.go:322–330  ·  view source on GitHub ↗

Next returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by Read. If there are fewer than n bytes in the buffer, Next returns the entire buffer. The slice is only valid until the next call to a read or write method.

(n int)

Source from the content-addressed store, hash-verified

320// If there are fewer than n bytes in the buffer, Next returns the entire buffer.
321// The slice is only valid until the next call to a read or write method.
322func (b *Buffer) Next(n int) []byte {
323 m := b.Len()
324 if n > m {
325 n = m
326 }
327 data := b.buf[b.off : b.off+n]
328 b.off += n
329 return data
330}
331
332// ReadByte reads and returns the next byte from the buffer.
333// If no byte is available, it returns error io.EOF.

Callers

nothing calls this directly

Calls 1

LenMethod · 0.95

Tested by

no test coverage detected