本文整理匯總了PHP中Zend_Io_Writer::writeInt8方法的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Io_Writer::writeInt8方法的具體用法?PHP Zend_Io_Writer::writeInt8怎麽用?PHP Zend_Io_Writer::writeInt8使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend_Io_Writer
的用法示例。
在下文中一共展示了Zend_Io_Writer::writeInt8方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: writeMessageData
/**
* Writes a data-record to the file.
* @param mixed[] $msg_def
* @param mixed[] $message_data
* @return \Fit\Writer
*/
protected function writeMessageData($msg_def, $message_data)
{
$local_msg_type = $this->getLocalMsgType($msg_def['global_msg_number']);
$this->writeRecordHeaderByte($local_msg_type, false);
//en nu de velddata wegschrijven
foreach ($msg_def['fields'] as $field_def) {
if (isset($message_data[$field_def[\Fit\Field::NAME]])) {
$val = $message_data[$field_def[\Fit\Field::NAME]];
} else {
$val = null;
}
if (is_numeric($val) && $field_def[\Fit\Field::FACTOR] > 0) {
$val /= $field_def[\Fit\Field::FACTOR];
}
$big_endian = $msg_def['architecture'] === 1;
switch ($field_def[\Fit\Field::TYPE_NUMBER]) {
case \Fit\Core::STRING:
$this->writer->writeString8((string) $val, $field_def[\Fit\Field::SIZE]);
break;
case \Fit\Core::SINT8:
$this->writer->writeInt8($val);
break;
case \Fit\Core::ENUM:
case \Fit\Core::UINT8Z:
case \Fit\Core::UINT8:
$this->writer->writeUInt8($val);
break;
case \Fit\Core::SINT16:
$big_endian ? $this->writer->writeInt16BE($val) : $this->writer->writeInt16LE($val);
break;
case \Fit\Core::UINT16Z:
case \Fit\Core::UINT16:
$big_endian ? $this->writer->writeUInt16BE($val) : $this->writer->writeUInt16LE($val);
break;
case \Fit\Core::SINT32:
$big_endian ? $this->writer->writeInt32BE($val) : $this->writer->writeInt32LE($val);
break;
case \Fit\Core::UINT32Z:
case \Fit\Core::UINT32:
$big_endian ? $this->writer->writeUInt32BE($val) : $this->writer->writeUInt32LE($val);
break;
case \Fit\Core::FLOAT32:
$big_endian ? $this->writer->writeFloatBE($val) : $this->writer->writeFloatLE($val);
break;
case \Fit\Core::FLOAT64:
$big_endian ? $this->writer->writeInt64BE($val) : $this->writer->writeInt64LE($val);
break;
case \Fit\Core::BYTE:
default:
$this->writer->write($val, $field_def[\Fit\Field::SIZE]);
}
}
return $this;
}
示例2: write
/**
* Writes the header data.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
public function write($writer)
{
/* ID3v2.3.0 ExtendedHeader */
if ($this->getOption('version', 4) < 4) {
$writer->writeUInt32BE($this->_size)->writeUInt16BE($this->hasFlag(self::CRC32) ? 0x8000 : 0)->writeUInt32BE($this->_padding);
if ($this->hasFlag(self::CRC32)) {
$writer->writeUInt32BE($this->_crc);
}
} else {
$writer->writeUInt32BE($this->_encodeSynchsafe32($this->_size))->writeInt8(1)->writeInt8($this->_flags);
if ($this->hasFlag(self::UPDATE)) {
$writer->write("");
}
if ($this->hasFlag(self::CRC32)) {
$writer->writeInt8(5)->writeInt8($this->_crc & 4026531840.0 >> 28 & 0xf)->writeUInt32BE($this->_encodeSynchsafe32($this->_crc));
}
if ($this->hasFlag(self::RESTRICTED)) {
$writer->writeInt8(1)->writeInt8($this->_restrictions);
}
}
}
示例3: write
/**
* Writes the header/footer data without the identifier.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
public function write($writer)
{
$writer->writeInt8(floor($this->_version))->writeInt8(($this->_version - floor($this->_version)) * 10)->writeInt8($this->_flags)->writeUInt32BE($this->_encodeSynchsafe32($this->_size));
}
示例4: _writeData
/**
* Writes the frame raw data without the header.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
protected function _writeData($writer)
{
$writer->writeInt8($this->_interpolation)->writeString8($this->_device, 1);
foreach ($this->_adjustments as $frequency => $adjustment) {
$writer->writeUInt16BE($frequency * 2)->writeInt16BE($adjustment * 512);
}
}
示例5: _writeData
/**
* Writes the frame raw data without the header.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
protected function _writeData($writer)
{
$writer->writeString8($this->_device, 1);
foreach ($this->_adjustments as $channel) {
$writer->writeInt8($channel[self::channelType])->writeInt16BE($channel[self::volumeAdjustment] * 512);
if (abs($channel[self::peakVolume]) <= 0xff) {
$writer->writeInt8(8)->writeUInt8($channel[self::peakVolume]);
} else {
if (abs($channel[self::peakVolume]) <= 0xffff) {
$writer->writeInt8(16)->writeUInt16BE($channel[self::peakVolume]);
} else {
if (abs($channel[self::peakVolume]) <= 0xffffffff) {
$writer->writeInt8(32)->writeUInt32BE($channel[self::peakVolume]);
} else {
$writer->writeInt8(64)->writeInt64BE($channel[self::peakVolume]);
// UInt64
}
}
}
}
}
示例6: _writeData
/**
* Writes the frame raw data without the header.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
protected function _writeData($writer)
{
$writer->writeInt8($flags = 0);
if ($this->_adjustments[self::right] > 0) {
$flags = $flags | 0x1;
}
if ($this->_adjustments[self::left] > 0) {
$flags = $flags | 0x2;
}
$writer->writeInt8(16)->writeUInt16BE(abs($this->_adjustments[self::right]))->writeUInt16BE(abs($this->_adjustments[self::left]))->writeUInt16BE(abs($this->_adjustments[self::peakRight]))->writeUInt16BE(abs($this->_adjustments[self::peakLeft]));
if (isset($this->_adjustments[self::rightBack]) && isset($this->_adjustments[self::leftBack]) && isset($this->_adjustments[self::peakRightBack]) && isset($this->_adjustments[self::peakLeftBack])) {
if ($this->_adjustments[self::rightBack] > 0) {
$flags = $flags | 0x4;
}
if ($this->_adjustments[self::leftBack] > 0) {
$flags = $flags | 0x8;
}
$writer->writeUInt16BE(abs($this->_adjustments[self::rightBack]))->writeUInt16BE(abs($this->_adjustments[self::leftBack]))->writeUInt16BE(abs($this->_adjustments[self::peakRightBack]))->writeUInt16BE(abs($this->_adjustments[self::peakLeftBack]));
}
if (isset($this->_adjustments[self::center]) && isset($this->_adjustments[self::peakCenter])) {
if ($this->_adjustments[self::center] > 0) {
$flags = $flags | 0x10;
}
$writer->writeUInt16BE(abs($this->_adjustments[self::center]))->writeUInt16BE(abs($this->_adjustments[self::peakCenter]));
}
if (isset($this->_adjustments[self::bass]) && isset($this->_adjustments[self::peakBass])) {
if ($this->_adjustments[self::bass] > 0) {
$flags = $flags | 0x20;
}
$writer->writeUInt16BE(abs($this->_adjustments[self::bass]))->writeUInt16BE(abs($this->_adjustments[self::peakBass]));
}
$writer->setOffset(0);
$writer->writeInt8($flags);
}
示例7: _writeData
/**
* Writes the frame raw data without the header.
*
* @param Zend_Io_Writer $writer The writer object.
* @return void
*/
protected function _writeData($writer)
{
$writer->writeInt8(16);
foreach ($this->_adjustments as $frequency => $adjustment) {
$writer->writeUInt16BE($adjustment > 0 ? $frequency | 0x8000 : $frequency & ~0x8000)->writeUInt16BE(abs($adjustment));
}
}