Beispiel #1
0
 /**
  * Constructs a readable GridFS stream.
  *
  * @param CollectionWrapper $collectionWrapper GridFS collection wrapper
  * @param stdClass          $file GridFS file document
  *
  * @throws CorruptFileException
  */
 public function __construct(CollectionWrapper $collectionWrapper, stdClass $file)
 {
     $this->file = $file;
     $this->chunksIterator = $collectionWrapper->getChunksIteratorByFilesId($this->file->_id);
     $this->numChunks = $file->length >= 0 ? ceil($file->length / $file->chunkSize) : 0;
     $this->initEmptyBuffer();
 }