def Read(self, length):
    """Read from the file."""
    if not self.IsFile():
      raise IOError("%s is not a file." % self.pathspec.last.path)

    available = min(self.size - self.offset, length)
    if available > 0:
      # This raises a RuntimeError in some situations.
      try:
        data = self.fd.read_random(self.offset, available,
                                   self.pathspec.last.ntfs_type,
                                   self.pathspec.last.ntfs_id)
      except __HOLE__ as e:
        raise IOError(e)

      self.offset += len(data)

      return data
    return ""
dataset/ETHPy150Open google/grr/grr/client/vfs_handlers/sleuthkit.py/TSKFile.Read