parameters: (self,imagefile=None,icat_fallback=True)
return_statement: return "".join(res)
docstring: Returns the contents of all the runs concatenated together. For allocated files
          this should be the original file contents.
docstring_summary: Returns the contents of all the runs concatenated together. For allocated files
          this should be the original file contents.
docstring_tokens: Returns the contents of all the runs concatenated together . For allocated files this should be the original file contents .
function: def contents(self,imagefile=None,icat_fallback=True):
          """ Returns the contents of all the runs concatenated together. For allocated files
          this should be the original file contents. """
          if imagefile is None     : imagefile=self.imagefile
          if imagefile is None     : raise ValueError("imagefile is unknown")
          if self.encrypted()      : raise ValueError("Cannot generate content for encrypted files")
          if self.compressed() or imagefile.name.endswith(".aff") or imagefile.name.endswith(".E01"):
              if icat_fallback:
                  #
                  # For now, compressed files rely on icat rather than python interface
                  #
                  offset     = safeInt(self.volume.offset)
                  block_size = safeInt(self.volume.block_size)
                  if block_size==0: block_size = 512
                  inode = self.inode()
                  if inode :
                      block_size = 512
                      fstype_flag = ""
                      fstype = self.volume.ftype_str()
                      if fstype != None:
                          fstype_flag = '-f' + fstype
                          cmd = ['icat',fstype_flag,'-b',str(block_size),'-o',str(offset//block_size),imagefile.name,str(inode)]
                      else:
                          cmd = ['icat','-b',str(block_size),'-o',str(offset//block_size),imagefile.name,str(inode)]
                      (data,err) = Popen(cmd, stdout=PIPE,stderr=PIPE).communicate()
                      # Check for an error
                      if len(err) > 0 :
                          #sys.stderr.write("Debug: type(err) = %r.\n" % type(err))
                          raise ValueError("icat error (" + str(err).strip() + "): "+" ".join(cmd))
                      return data
                  else :
                      raise ValueError("Inode missing from file in compressed format.")
              raise ValueError("Cannot read raw bytes in compressed disk image")
          res = []
          for run in self.byte_runs():
              res.append(self.content_for_run(run=run,imagefile=imagefile))
          return "".join(res)
function_tokens: def contents ( self , imagefile = None , icat_fallback = True ) : if imagefile is None : imagefile = self . imagefile if imagefile is None : raise ValueError ( "imagefile is unknown" ) if self . encrypted ( ) : raise ValueError ( "Cannot generate content for encrypted files" ) if self . compressed ( ) or imagefile . name . endswith ( ".aff" ) or imagefile . name . endswith ( ".E01" ) : if icat_fallback : # # For now, compressed files rely on icat rather than python interface # offset = safeInt ( self . volume . offset ) block_size = safeInt ( self . volume . block_size ) if block_size == 0 : block_size = 512 inode = self . inode ( ) if inode : block_size = 512 fstype_flag = "" fstype = self . volume . ftype_str ( ) if fstype != None : fstype_flag = '-f' + fstype cmd = [ 'icat' , fstype_flag , '-b' , str ( block_size ) , '-o' , str ( offset // block_size ) , imagefile . name , str ( inode ) ] else : cmd = [ 'icat' , '-b' , str ( block_size ) , '-o' , str ( offset // block_size ) , imagefile . name , str ( inode ) ] ( data , err ) = Popen ( cmd , stdout = PIPE , stderr = PIPE ) . communicate ( ) # Check for an error if len ( err ) > 0 : #sys.stderr.write("Debug: type(err) = %r.\n" % type(err)) raise ValueError ( "icat error (" + str ( err ) . strip ( ) + "): " + " " . join ( cmd ) ) return data else : raise ValueError ( "Inode missing from file in compressed format." ) raise ValueError ( "Cannot read raw bytes in compressed disk image" ) res = [ ] for run in self . byte_runs ( ) : res . append ( self . content_for_run ( run = run , imagefile = imagefile ) ) return "" . join ( res )