MCPcopy Create free account
hub / github.com/pquerna/ffjson / readSlice

Method readSlice

fflib/v1/buffer.go:381–391  ·  view source on GitHub ↗

readSlice is like ReadBytes but returns a reference to internal buffer data.

(delim byte)

Source from the content-addressed store, hash-verified

379
380// readSlice is like ReadBytes but returns a reference to internal buffer data.
381func (b *Buffer) readSlice(delim byte) (line []byte, err error) {
382 i := bytes.IndexByte(b.buf[b.off:], delim)
383 end := b.off + i + 1
384 if i < 0 {
385 end = len(b.buf)
386 err = io.EOF
387 }
388 line = b.buf[b.off:end]
389 b.off = end
390 return line, err
391}
392
393// ReadString reads until the first occurrence of delim in the input,
394// returning a string containing the data up to and including the delimiter.

Callers 2

ReadBytesMethod · 0.95
ReadStringMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected