/** * Create a new QtiBinaryStreamAccess object. * * @param IStream $stream The IStream object to be accessed. * @throws BinaryStreamAccessException If $stream is not open yet. */ public function __construct(IStream $stream) { parent::__construct($stream); }
public function testWriteFloat() { $stream = $this->getEmptyStream(); $access = new BinaryStreamAccess($stream); $access->writeFloat(0.0); $access->writeFloat(-M_PI); $access->writeFloat(M_2_PI); $stream->rewind(); $val = $access->readFloat(); $this->assertInternalType('float', $val); $this->assertEquals(round(0.0, 3), round($val, 3)); $val = $access->readFloat(); $this->assertInternalType('float', $val); $this->assertEquals(round(-M_PI, 3), round($val, 3)); $val = $access->readFloat(); $this->assertInternalType('float', $val); $this->assertEquals(round(M_2_PI, 3), round($val, 3)); }
/** * Create a new QtiBinaryStreamAccess object. * * @param \qtism\common\storage\IStream $stream The IStream object to be accessed. * @throws \qtism\common\storage\BinaryStreamAccessException If $stream is not open yet. */ public function __construct(IStream $stream, FileManager $fileManager) { parent::__construct($stream); $this->setFileManager($fileManager); }