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

Method getNullableInt32Array

real_decoder.go:236–259  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

234}
235
236func (rd *realDecoder) getNullableInt32Array() ([]int32, error) {
237 n, err := rd.getArrayLength()
238 if err != nil {
239 return nil, err
240 }
241 if n < -1 {
242 return nil, errInvalidArrayLength
243 }
244 if n == -1 {
245 return nil, nil
246 }
247
248 if rd.remaining()/4 < n {
249 rd.off = len(rd.raw)
250 return nil, ErrInsufficientData
251 }
252
253 ret := make([]int32, n)
254 for i := range ret {
255 ret[i] = int32(binary.BigEndian.Uint32(rd.raw[rd.off:]))
256 rd.off += 4
257 }
258 return ret, nil
259}
260
261func (rd *realDecoder) getInt32Array() ([]int32, error) {
262 ret, err := rd.getNullableInt32Array()

Callers 2

getInt32ArrayMethod · 0.95

Calls 2

getArrayLengthMethod · 0.95
remainingMethod · 0.95

Tested by 1