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

Method ReadBytes

fflib/v1/buffer.go:372–378  ·  view source on GitHub ↗

ReadBytes reads until the first occurrence of delim in the input, returning a slice containing the data up to and including the delimiter. If ReadBytes encounters an error before finding a delimiter, it returns the data read before the error and the error itself (often io.EOF). ReadBytes returns err

(delim byte)

Source from the content-addressed store, hash-verified

370// ReadBytes returns err != nil if and only if the returned data does not end in
371// delim.
372func (b *Buffer) ReadBytes(delim byte) (line []byte, err error) {
373 slice, err := b.readSlice(delim)
374 // return a copy of slice. The buffer's backing array may
375 // be overwritten by later calls.
376 line = append(line, slice...)
377 return
378}
379
380// readSlice is like ReadBytes but returns a reference to internal buffer data.
381func (b *Buffer) readSlice(delim byte) (line []byte, err error) {

Callers

nothing calls this directly

Calls 1

readSliceMethod · 0.95

Tested by

no test coverage detected