本文整理汇总了PHP中Reader::getSize方法的典型用法代码示例。如果您正苦于以下问题:PHP Reader::getSize方法的具体用法?PHP Reader::getSize怎么用?PHP Reader::getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reader
的用法示例。
在下文中一共展示了Reader::getSize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructs the ID3v1 class with given file. The file is not mandatory
* argument and may be omitted. A new tag can be written to a file also by
* giving the filename to the {@link #write} method of this class.
*
* @param string $filename The path to the file.
*/
public function __construct($filename = false)
{
if (($this->_filename = $filename) === false || file_exists($filename) === false) {
return;
}
$this->_reader = new Reader($filename);
if ($this->_reader->getSize() < 128) {
return;
}
$this->_reader->setOffset(-128);
if ($this->_reader->read(3) != "TAG") {
$this->_reader = false;
// reset reader, see write
return;
}
$this->_title = rtrim($this->_reader->readString8(30), " ");
$this->_artist = rtrim($this->_reader->readString8(30), " ");
$this->_album = rtrim($this->_reader->readString8(30), " ");
$this->_year = $this->_reader->readString8(4);
$this->_comment = rtrim($this->_reader->readString8(28), " ");
/* ID3v1.1 support for tracks */
$v11_null = $this->_reader->read(1);
$v11_track = $this->_reader->read(1);
if (ord($v11_null) == 0 && ord($v11_track) != 0) {
$this->_track = ord($v11_track);
} else {
$this->_comment = rtrim($this->_comment . $v11_null . $v11_track, " ");
}
$this->_genre = $this->_reader->readInt8();
}
示例2: constructBoxes
/**
* Reads and constructs the boxes found within this box.
*
* @todo Does not parse iTunes internal ---- boxes.
*/
protected function constructBoxes($defaultclassname = "ISO14496_Box")
{
$base = $this->getOption("base", "");
if ($this->getType() != "file")
self::$_path[] = $this->getType();
$path = implode(self::$_path, ".");
while (true) {
$offset = $this->_reader->getOffset();
if ($offset >= $this->_offset + $this->_size)
break;
$size = $this->_reader->readUInt32BE();
$type = rtrim($this->_reader->read(4), " ");
if ($size == 1)
$size = $this->_reader->readInt64BE();
if ($size == 0)
$size = $this->_reader->getSize() - $offset;
if (preg_match("/^\xa9?[a-z0-9]{3,4}$/i", $type) &&
substr($base, 0, min(strlen($base), strlen
($tmp = $path . ($path ? "." : "") . $type))) ==
substr($tmp, 0, min(strlen($base), strlen($tmp))))
{
$this->_reader->setOffset($offset);
if (@fopen($filename = "ISO14496/Box/" . strtoupper($type) . ".php",
"r", true) !== false)
require_once($filename);
if (class_exists($classname = "ISO14496_Box_" . strtoupper($type)))
$box = new $classname($this->_reader, $this->_options);
else
$box = new $defaultclassname($this->_reader, $this->_options);
$box->setParent($this);
if (!isset($this->_boxes[$box->getType()]))
$this->_boxes[$box->getType()] = array();
$this->_boxes[$box->getType()][] = $box;
}
$this->_reader->setOffset($offset + $size);
}
array_pop(self::$_path);
}
示例3: constructBoxes
/**
* Reads and constructs the boxes found within this box.
*
* @todo Does not parse iTunes internal ---- boxes.
*/
protected final function constructBoxes($defaultclassname = 'Zend_Media_Iso14496_Box')
{
$base = $this->getOption('base', '');
if ($this->getType() != 'file') {
self::$_path[] = $this->getType();
}
$path = implode(self::$_path, '.');
while (true) {
$offset = $this->_reader->getOffset();
if ($offset >= $this->_offset + $this->_size) {
break;
}
$size = $this->_reader->readUInt32BE();
$type = rtrim($this->_reader->read(4), ' ');
if ($size == 1) {
$size = $this->_reader->readInt64BE();
}
if ($size == 0) {
$size = $this->_reader->getSize() - $offset;
}
if (preg_match("/^©?[a-z0-9]{3,4}\$/i", $type) && substr($base, 0, min(strlen($base), strlen($tmp = $path . ($path ? '.' : '') . $type))) == substr($tmp, 0, min(strlen($base), strlen($tmp)))) {
$this->_reader->setOffset($offset);
if (@fopen($filename = 'Zend/Media/Iso14496/Box/' . ucfirst($type) . '.php', 'r', true) !== false) {
require_once $filename;
}
if (class_exists($classname = 'Zend_Media_Iso14496_Box_' . ucfirst($type))) {
$box = new $classname($this->_reader, $this->_options);
} else {
$box = new $defaultclassname($this->_reader, $this->_options);
}
$box->setParent($this);
if (!isset($this->_boxes[$box->getType()])) {
$this->_boxes[$box->getType()] = array();
}
$this->_boxes[$box->getType()][] = $box;
}
$this->_reader->setOffset($offset + $size);
}
array_pop(self::$_path);
}
示例4: __construct
/**
* Reads the magic information from given magic file.
*
* @param string $filename The path to the magic file.
*/
public function __construct($filename)
{
$reader = new Reader($filename);
$this->_magic = $reader->read($reader->getSize());
}
示例5: __construct
/**
* Constructs the ID3v1 class with given file. The file is not mandatory
* argument and may be omitted. A new tag can be written to a file also by
* giving the filename to the {@link #write} method of this class.
*
* @param string|Reader $filename The path to the file, file descriptor of an
* opened file, or {@link Reader} instance.
*/
public function __construct($filename = false)
{
if ($filename instanceof Reader)
$this->_reader = &$filename;
else if ((is_string($filename) && ($this->_filename = $filename) !== false &&
file_exists($filename) !== false) ||
(is_resource($filename) &&
in_array(get_resource_type($filename), array("file", "stream"))))
$this->_reader = new Reader($filename);
else
return;
if ($this->_reader->getSize() < 128)
throw new ID3_Exception("File does not contain ID3v1 tag");
$this->_reader->setOffset(-128);
if ($this->_reader->read(3) != "TAG") {
$this->_reader = false; // reset reader, see write
throw new ID3_Exception("File does not contain ID3v1 tag");
}
$this->_title = rtrim($this->_reader->readString8(30), " \0");
$this->_artist = rtrim($this->_reader->readString8(30), " \0");
$this->_album = rtrim($this->_reader->readString8(30), " \0");
$this->_year = $this->_reader->readString8(4);
$this->_comment = rtrim($this->_reader->readString8(28), " \0");
/* ID3v1.1 support for tracks */
$v11_null = $this->_reader->read(1);
$v11_track = $this->_reader->read(1);
if (ord($v11_null) == 0 && ord($v11_track) != 0)
$this->_track = ord($v11_track);
else
$this->_comment = rtrim($this->_comment . $v11_null . $v11_track, " \0");
$this->_genre = $this->_reader->readInt8();
}