MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / read_string

Method read_string

src/packagedcode/pyrpm.py:323–334  ·  view source on GitHub ↗
(cls, store, count)

Source from the content-addressed store, hash-verified

321
322 @classmethod
323 def read_string(cls, store, count):
324 string = b''
325 while True:
326 char = cls.read_char(store, count=1)
327 if len(char) == 0 or char == b'\x00':
328 # read until '\0'
329 break
330 string += char
331 # We decode as UTF-8 by default and avoid errors with a replacement.
332 # UTF-8 should be the standard for RPMs, though for older rpms mileage
333 # may vary
334 return string and string.decode('utf-8', errors='replace') or None
335
336 @classmethod
337 def read_string_array(cls, store, count):

Callers 1

read_string_arrayMethod · 0.80

Calls 2

read_charMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected