Exemplo n.º 1
0
 /**
  * Send the content of the files to a memory buffer
  *
  * toMemory returns a writer where the data will be written.
  * In this case, the data is accessible using the getData member
  *
  * toVariable returns a writer that will write into the given
  * variable
  *
  * @param out $data if specified, the data will be written to this buffer
  *        Else, you can retrieve the buffer with the
  *        File_Archive_Writer_Memory::getData() function
  * @see   File_Archive_Writer_Memory
  */
 function toMemory()
 {
     $v = '';
     return File_Archive::toVariable($v);
 }
Exemplo n.º 2
0
 function _testRemove($extension)
 {
     $writer = File_Archive::toArchive("test.{$extension}", File_Archive::toVariable($x));
     $writer->newFile('foo.txt');
     $writer->writeData('ABCDEF');
     $writer->newFile('bla_to_remove.txt');
     $writer->writeData('GHIJKL');
     $writer->newFile('bar.txt');
     $writer->writeData('MNOP');
     $writer->close();
     File_Archive::removeFromSource(File_Archive::predEreg('_to_remove'), $source = File_Archive::readSource(File_Archive::readMemory($x, "test.{$extension}"), "test.{$extension}/"));
     $this->assertEquals("foo.txt\nbar.txt", implode("\n", $source->getFileList()));
 }