Example #1
0
 function testConcatReader()
 {
     $source = File_Archive::readMulti();
     $source->addSource(File_Archive::readMemory("ABCDE", "fo"));
     $source->addSource(File_Archive::readMemory("FGHIJ", "ob"));
     $source->addSource(File_Archive::readMemory("KLMNO", "ar"));
     $reader = File_Archive::readConcat($source, "foobar");
     $this->assertTrue($reader->next());
     $this->assertEquals("ABC", $reader->getData(3));
     $this->assertEquals("DEF", $reader->getData(3));
     $this->assertEquals("GHIJKLMNO", $reader->getData());
     $this->assertFalse($reader->next());
     $reader->close();
 }
Example #2
0
 /**
  * Try to interpret the object as a reader
  * Strings are converted to readers using File_Archive::read
  * Arrays are converted to readers using File_Archive::readMulti
  *
  * @access private
  */
 function &_convertToReader(&$source)
 {
     if (is_string($source)) {
         $cacheCondition = File_Archive::getOption('cacheCondition');
         if ($cacheCondition !== false && preg_match($cacheCondition, $source)) {
             return File_Archive::cache(File_Archive::read($source));
         } else {
             return File_Archive::read(@$source);
         }
     } else {
         if (is_array($source)) {
             return File_Archive::readMulti($source);
         } else {
             return $source;
         }
     }
 }
Example #3
0
 /**
  * Try to interpret the object as a reader
  * Strings are converted to readers using File_Archive::read
  * Arrays are converted to readers using File_Archive::readMulti
  *
  * @access private
  */
 function &_convertToReader(&$source)
 {
     if (is_string($source)) {
         $cacheCondition = File_Archive::getOption('cacheCondition');
         if ($cacheCondition !== false && preg_match($cacheCondition, $source)) {
             $obj = File_Archive::cache(File_Archive::read($source));
             return $obj;
         } else {
             $obj = File_Archive::read($source);
             return $obj;
         }
     } else {
         if (is_array($source)) {
             // PHP_Noticeがでるため修正 by S.Nakajima
             $obj = File_Archive::readMulti($source);
             return $obj;
         } else {
             return $source;
         }
     }
 }