MCPcopy Create free account
hub / github.com/IBM/sarama / getStringLength

Method getStringLength

real_decoder.go:195–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

193}
194
195func (rd *realDecoder) getStringLength() (int, error) {
196 length, err := rd.getInt16()
197 if err != nil {
198 return 0, err
199 }
200
201 n := int(length)
202
203 switch {
204 case n < -1:
205 return 0, errInvalidStringLength
206 case n > rd.remaining():
207 rd.off = len(rd.raw)
208 return 0, ErrInsufficientData
209 }
210
211 return n, nil
212}
213
214func (rd *realDecoder) getString() (string, error) {
215 n, err := rd.getStringLength()

Callers 2

getStringMethod · 0.95
getNullableStringMethod · 0.95

Calls 2

getInt16Method · 0.95
remainingMethod · 0.95

Tested by

no test coverage detected