本文整理汇总了PHP中Reader::readUInt8方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::readUInt8方法的具体用法?PHP Reader::readUInt8怎么用?PHP Reader::readUInt8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader::readUInt8方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs the class with given parameters.
*
* @param Zend_Io_Reader $reader The reader object.
* @param Array $options The options array.
*/
public function __construct($reader)
{
$this->_reader = $reader;
if (!in_array($this->_packetType = $this->_reader->readUInt8(), array(1, 3, 5))) {
require_once 'Zend/Media/Vorbis/Exception.php';
throw new Zend_Media_Vorbis_Exception('Unknown header packet type: ' . $this->_packetType);
}
if (($vorbis = $this->_reader->read(6)) != 'vorbis') {
require_once 'Zend/Media/Vorbis/Exception.php';
throw new Zend_Media_Vorbis_Exception('Unknown header packet: ' . $vorbis);
}
$skipBytes = $this->_reader->getCurrentPagePosition();
for ($page = $this->_reader->getCurrentPageNumber();; $page++) {
$segments = $this->_reader->getPage($page)->getSegmentTable();
for ($i = 0, $skippedSegments = 0; $i < count($segments); $i++) {
// Skip page segments that are already read in
if ($skipBytes > $segments[$i]) {
$skipBytes -= $segments[$i];
continue;
}
// Skip segments that are full
if ($segments[$i] == 255 && ++$skippedSegments) {
continue;
}
// Record packet size from the first non-255 segment
$this->_packetSize += $i * 255 + $segments[$i];
break 2;
}
$this->_packetSize += $skippedSegments * 255;
}
}