本文整理汇总了PHP中TeamSpeak3_Helper_String::append方法的典型用法代码示例。如果您正苦于以下问题:PHP TeamSpeak3_Helper_String::append方法的具体用法?PHP TeamSpeak3_Helper_String::append怎么用?PHP TeamSpeak3_Helper_String::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TeamSpeak3_Helper_String
的用法示例。
在下文中一共展示了TeamSpeak3_Helper_String::append方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: download
/**
* Returns the content of a downloaded file as a TeamSpeak3_Helper_String object.
*
* @param string $key
* @param integer $size
* @throws TeamSpeak3_Adapter_Exception
* @return TeamSpeak3_Helper_String
*/
public function download($ftkey, $size)
{
$this->init($ftkey);
$buff = new TeamSpeak3_Helper_String("");
$size = intval($size);
$pack = 4096;
for ($seek = 0; $seek < $size;) {
$rest = $size - $seek;
$pack = $rest < $pack ? $rest : $pack;
$data = $this->getTransport()->read($rest < $pack ? $rest : $pack);
$seek = $seek + $pack;
$buff->append($data);
}
$this->getProfiler()->stop();
if (strlen($buff) != $size) {
throw new TeamSpeak3_Adapter_Exception("incomplete file download (" . count($buff) . " of " . $size . " bytes)");
}
return $buff;
}