Returns the list of filenames from the current pos to the end of the source The source will be closed after having called this function This function goes through the whole archive (which may be slow).
If you intend to work on the reader, doing it in one pass would be faster
File_Archive_Writer makeWriter(
[bool
$fileModif = true], [int
$seek = 0])
|
|
Returns a writer that will start writing at the current pos in the source Any data (from current file or any other file) located after current pos will be erased.
For security reasons, calling makeWriter on a directory reader will not erase any file though. $this->close will be called and after this function the reader is invalid (and should no longer be used).
If $fileModif is true, the writer will allow editing the current file (or the last file if the end of the archive has been reached) Thus it is an error to call makeWriter with fileModif to true if the reader has not been opened (no call to next() have been done, or first call to next returned false). In this case, $seek allows to change the position from where the file must be edited
If $fileModif is false, the writer will not allow to edit the current file, and the first function call should be new file. The current file will be left unchanged If the first function call is writeData, the behaviour is undefined (it will generally result in invalid archives). In this case, $seek is not used
Here is how to append a single file to an existing zip archive <sample> $archive = File_Archive::read('archive.zip/'); $file = File_Archive::read('foo.txt'); $file->extract($source->makeAppendWriter()); </sample>
Append the content of a tgz archive to an existing zip archive <sample> $archive = File_Archive::read('archive.zip/'); $file = File_Archive::read('archive.tgz/'); $file->extract($source->makeAppendWriter()); </sample>
Overridden in child classes as:
- File_Archive_Reader_Memory::makeWriter()
- File_Archive_Reader_File::makeWriter()
- File_Archive_Reader_Concat::makeWriter()
- File_Archive_Reader_Gzip::makeWriter()
- File_Archive_Reader_Tar::makeWriter()
- File_Archive_Reader_Bzip2::makeWriter()
- File_Archive_Reader_Zip::makeWriter()
- File_Archive_Reader_Ar::makeWriter()
- File_Archive_Reader_Relay::makeWriter()
- File_Archive_Reader_Directory::makeWriter()
Parameters: