MCPcopy Create free account
hub / github.com/oschwald/maxminddb-golang / decodeString

Method decodeString

internal/decoder/data_decoder.go:295–303  ·  view source on GitHub ↗

DecodeString decodes a string from the given offset.

(size, offset uint)

Source from the content-addressed store, hash-verified

293
294// DecodeString decodes a string from the given offset.
295func (d *DataDecoder) decodeString(size, offset uint) (string, uint, error) {
296 if offset+size > uint(len(d.buffer)) {
297 return "", 0, mmdberrors.NewOffsetError()
298 }
299
300 newOffset := offset + size
301 value := d.stringCache.internAt(offset, size, d.buffer)
302 return value, newOffset, nil
303}
304
305// DecodeUint16 decodes a 16-bit unsigned integer from the given offset.
306func (d *DataDecoder) decodeUint16(size, offset uint) (uint16, uint, error) {

Callers 4

ReadStringMethod · 0.80
unmarshalStringMethod · 0.80
tryFastDecodeTypedMethod · 0.80

Calls 2

NewOffsetErrorFunction · 0.92
internAtMethod · 0.80

Tested by 1