parameters: (f)
docstring: r"""
      >>> import StringIO
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x00abc"))
      ''
      >>> read_string4(StringIO.StringIO("\x03\x00\x00\x00abcdef"))
      'abc'
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x03abcdef"))
      Traceback (most recent call last):
      ...
      ValueError: expected 50331648 bytes in a string4, but only 6 remain
docstring_summary: r"""
      >>> import StringIO
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x00abc"))
      ''
      >>> read_string4(StringIO.StringIO("\x03\x00\x00\x00abcdef"))
      'abc'
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x03abcdef"))
      Traceback (most recent call last):
      ...
      ValueError: expected 50331648 bytes in a string4, but only 6 remain
docstring_tokens: r >>> import StringIO >>> read_string4 ( StringIO . StringIO ( \ x00 \ x00 \ x00 \ x00abc )) >>> read_string4 ( StringIO . StringIO ( \ x03 \ x00 \ x00 \ x00abcdef )) abc >>> read_string4 ( StringIO . StringIO ( \ x00 \ x00 \ x00 \ x03abcdef )) Traceback ( most recent call last ) : ... ValueError : expected 50331648 bytes in a string4 but only 6 remain
function: def read_string4(f):
      r"""
      >>> import StringIO
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x00abc"))
      ''
      >>> read_string4(StringIO.StringIO("\x03\x00\x00\x00abcdef"))
      'abc'
      >>> read_string4(StringIO.StringIO("\x00\x00\x00\x03abcdef"))
      Traceback (most recent call last):
      ...
      ValueError: expected 50331648 bytes in a string4, but only 6 remain
      """
  
      n = read_int4(f)
      if n < 0:
          raise ValueError("string4 byte count < 0: %d" % n)
      data = f.read(n)
      if len(data) == n:
          return data
      raise ValueError("expected %d bytes in a string4, but only %d remain" %
                       (n, len(data)))
function_tokens: def read_string4 ( f ) : n = read_int4 ( f ) if n < 0 : raise ValueError ( "string4 byte count < 0: %d" % n ) data = f . read ( n ) if len ( data ) == n : return data raise ValueError ( "expected %d bytes in a string4, but only %d remain" % ( n , len ( data ) ) )