MCPcopy
hub / github.com/segmentio/kafka-go / NewBytes

Function NewBytes

protocol/buffer.go:37–44  ·  view source on GitHub ↗

NewBytes constructs a Bytes value from b. The returned value references b, it does not make a copy of the backing array. If b is nil, nil is returned to represent a null BYTES value in the kafka protocol.

(b []byte)

Source from the content-addressed store, hash-verified

35// If b is nil, nil is returned to represent a null BYTES value in the kafka
36// protocol.
37func NewBytes(b []byte) Bytes {
38 if b == nil {
39 return nil
40 }
41 r := new(bytesReader)
42 r.Reset(b)
43 return r
44}
45
46// ReadAll is similar to ioutil.ReadAll, but it takes advantage of knowing the
47// length of b to minimize the memory footprint.

Callers 7

NewBytesFunction · 0.92
RecordMethod · 0.92
BytesFunction · 0.92
StringFunction · 0.92
RecordMethod · 0.70
KeyMethod · 0.70
ValueMethod · 0.70

Calls 1

ResetMethod · 0.45

Tested by 1

RecordMethod · 0.56