def AddFile(self, fd, external=True):
    """Create a new file in the file store.

    We delegate the actual file addition to our contained
    implementations. Implementations can either implement the AddFile() method,
    returning a file like object which will be written on, or directly support
    the AddBlobToStore() method which can copy the VFSBlobImage efficiently.

    Args:
      fd: An AFF4 object open for read/write.
      external: If true, attempt to add files to stores defined as EXTERNAL.
    """
    files_for_write = []

    for sub_store in self.GetChildrenByPriority(allow_external=external):
      new_file = sub_store.AddFile(fd)
      if new_file:
        files_for_write.append(new_file)

    fd.Seek(0)
    while files_for_write:
      # If we got filehandles back, send them the data.
      data = fd.Read(self.CHUNK_SIZE)
      if not data:
        break

      for child in files_for_write:
        child.Write(data)

    for child in files_for_write:
      child.Close()
def AddFile ( self , fd , external = True ) : files_for_write = [ ] for sub_store in self . GetChildrenByPriority ( allow_external = external ) : new_file = sub_store . AddFile ( fd ) if new_file : files_for_write . append ( new_file ) fd . Seek ( 0 ) while files_for_write : data = fd . Read ( self . CHUNK_SIZE ) if not data : break for child in files_for_write : child . Write ( data ) for child in files_for_write : child . Close ( )
Create a new file in the file store.

    We delegate the actual file addition to our contained
    implementations. Implementations can either implement the AddFile() method,
    returning a file like object which will be written on, or directly support
    the AddBlobToStore() method which can copy the VFSBlobImage efficiently.

    Args:
      fd: An AFF4 object open for read/write.
      external: If true, attempt to add files to stores defined as EXTERNAL.