docstr: Read and return up to size bytes, where size is an int.
  
  If the argument is omitted, None, or negative, reads and
  returns all data until EOF.
  
  If the argument is positive, multiple raw reads may be issued to satisfy
  the byte count (unless EOF is reached first).
  
  Returns an empty bytes array on EOF.
docstr_tok: ["Read","and","return","up","to","size","bytes",",","where","size","is","an","int",".","If","the","argument","is","omitted",",","None",",","or","negative",",","reads","and","returns","all","data","until","EOF",".","If","the","argument","is","positive",",","multiple","raw","reads","may","be","issued","to","satisfy","the","byte","count","(","unless","EOF","is","reached","first",")",".","Returns","an","empty","bytes","array","on","EOF","."]
code: def read(self, size=-1):
      """
      Read and return up to size bytes, where size is an int.
  
      If the argument is omitted, None, or negative, reads and
      returns all data until EOF.
  
      If the argument is positive, multiple raw reads may be issued to satisfy
      the byte count (unless EOF is reached first).
  
      Returns an empty bytes array on EOF.
      """
      if self._current_pos == self._get_size() or size == 0:
          return b""
      elif size < 0:
          obj = self._bucket.get_object(
              self._key_name, byte_range=(self._current_pos, None)
          )
          self._current_pos = self._get_size()
      else:
          obj = self._bucket.get_object(
              self._key_name,
              byte_range=(
                  self._current_pos,
                  self._current_pos + size - 1,
              ),
          )
          self._current_pos = self._current_pos + size
      content = obj.read()
      return content
  
file_path: mars/mars/lib/filesystem/_oss_lib/handle.py
imports: from io import IOBase
  from ....utils import lazy_import
  from .common import parse_osspath, oss_stat
label_desc: Use image node_id 8 for calling the OSSIOBase obj's underlying member method code with example usage: obj.read(size) and returns: content, bytes