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

Function readNewBytes

read.go:144–166  ·  view source on GitHub ↗
(r *bufio.Reader, sz int, n int)

Source from the content-addressed store, hash-verified

142}
143
144func readNewBytes(r *bufio.Reader, sz int, n int) ([]byte, int, error) {
145 var err error
146 var b []byte
147 var shortRead bool
148
149 if n > 0 {
150 if sz < n {
151 n = sz
152 shortRead = true
153 }
154
155 b = make([]byte, n)
156 n, err = io.ReadFull(r, b)
157 b = b[:n]
158 sz -= n
159
160 if err == nil && shortRead {
161 err = errShortRead
162 }
163 }
164
165 return b, sz, err
166}
167
168func readArrayLen(r *bufio.Reader, sz int, n *int) (int, error) {
169 var err error

Callers 7

readMessageErrMethod · 0.85
readNewBytesMethod · 0.85
TestReadNewBytesFunction · 0.85
saslAuthenticateMethod · 0.85
readNewStringFunction · 0.85
readBytesFunction · 0.85
ReadMessageMethod · 0.85

Calls

no outgoing calls

Tested by 2

readMessageErrMethod · 0.68
TestReadNewBytesFunction · 0.68