当前位置: 首页>>代码示例>>PHP>>正文


PHP tool::fprint方法代码示例

本文整理汇总了PHP中tool::fprint方法的典型用法代码示例。如果您正苦于以下问题:PHP tool::fprint方法的具体用法?PHP tool::fprint怎么用?PHP tool::fprint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tool的用法示例。


在下文中一共展示了tool::fprint方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 public static function store($value)
 {
     if (\tool::debug()) {
         \tool::fprint("Storing " . get_called_class() . ":{$value}");
     }
     return Writer::convert('d', $value);
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:7,代码来源:TAG_Double.php

示例2: __construct

 public function __construct($name = null, $content = array())
 {
     \tool::fprint("Creating " . get_called_class() . (count($content) ? " with " . count($content) . " elements" : ''));
     parent::__construct();
     $this->name = $name;
     $this->content = $content ? (array) $content : array();
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:7,代码来源:TAG_Array.php

示例3: save

 public function save(SplFileObject $file)
 {
     $result = parent::save($file);
     if (isset($this->type)) {
         $result += $file->fwrite(Dictionary::mapName($this->type));
     } else {
         if (count($this->content)) {
             throw new UnexpectedValueException('Populated list needs an explicit type cast.');
         } else {
             $result += $file->fwrite(Dictionary::mapName('TAG_End'));
         }
     }
     $result += $file->fwrite(TAG_Int::store(count($this->content)));
     if (\tool::debug()) {
         \tool::fprint("Storing " . count($this->content) . " values of type {$this->type} @{$file->ftell()} ...");
     }
     $type = $this->type;
     foreach ($this->content as $index => $tag) {
         if (!is_object($tag)) {
             $result += $file->fwrite($type::store($tag));
         } else {
             if ($tag instanceof $this->type) {
                 if (isset($tag->name)) {
                     throw new UnexpectedValueException("List#{$index} is a named tag.");
                 }
                 $result += $tag->save($file);
             } else {
                 throw new UnexpectedValueException("List#{$index} type '" . get_class($tag) . "' doesn't match the list type '{$this->type}'.");
             }
         }
     }
     return $result;
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:33,代码来源:TAG_List.php

示例4: write

 public function write(Tag $tag)
 {
     \tool::fprint("Writing ... " . get_called_class() . "@{$this->file->ftell()}");
     $tmp = new SplFileObject('php://memory', 'wb+');
     $tag->save($tmp);
     $pos = $tmp->ftell();
     $tmp->fseek(0);
     return $this->file->fwrite(gzencode($tmp->fread($pos), 9, FORCE_GZIP));
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:9,代码来源:CompressedWriter.php

示例5: store

 public static function store($value)
 {
     if ($value < -2147483648 || $value > 2147483647) {
         throw new RangeException('Value is out of allowed range for given type.');
     }
     if (\tool::debug()) {
         \tool::fprint("Storing " . get_called_class() . ":{$value}");
     }
     return Writer::convert('l', (int) $value);
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:10,代码来源:TAG_Int.php

示例6: store

 public static function store($value)
 {
     $len = strlen($value);
     if ($len < 0 || $len > 32767) {
         throw new \LengthException('Valid string length range is 0..32767.');
     }
     if (\tool::debug()) {
         \tool::fprint("Storing " . get_called_class() . ":{$value}");
     }
     return TAG_Short::store($len) . $value;
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:11,代码来源:TAG_String.php

示例7: save

 public function save(SplFileObject $file)
 {
     $result = parent::save($file) + $file->fwrite(TAG_Int::store(count($this->content)));
     if (\tool::debug()) {
         \tool::fprint("Storing " . count($this->content) . " values @{$file->ftell()} ...");
     }
     ksort($this->content);
     foreach ($this->content as $value) {
         $result += $file->fwrite(TAG_Byte::store($value));
     }
     return $result;
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:12,代码来源:TAG_Byte_Array.php

示例8: fread

 public function fread($length)
 {
     if ($length < 0) {
         throw new RuntimeException("Backward reads are not supported.");
     }
     \tool::fprint("Reading {$length} from " . get_called_class() . "::" . __FUNCTION__ . "@{$this->file->ftell()}");
     if ($length) {
         $pos = $this->file->ftell();
         $data = $this->file->fread($length);
         if ($data === false) {
             throw new RuntimeException("Error while reading from file pointer.");
         }
         if (strlen($data) < $length) {
             throw new UnderflowException("Read " . strlen($data) . " out of {$length} requested bytes from file pointer @{$pos}.");
         }
     } else {
         $data = '';
     }
     return $data;
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:20,代码来源:Reader.php

示例9: save

 public function save(SplFileObject $file)
 {
     $result = parent::save($file);
     if (\tool::debug()) {
         \tool::fprint("Storing " . count($this->content) . " values @{$file->ftell()} ...");
     }
     $i = 1;
     foreach ($this->content as $tag) {
         if ($tag instanceof TAG_End) {
             break;
         }
         $result += $tag->save($file);
         $i++;
     }
     if (\tool::debug()) {
         if ($i < count($this->content)) {
             # TODO: Check if the tag is TAG_End at insetion times.
             \tool::fprint("Stored {$i} values! Don't stuff TAG_End in the middle of compound tags!");
         }
     }
     return $result + $file->fwrite(Dictionary::mapName("TAG_End"));
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:22,代码来源:TAG_Compound.php

示例10: write

 public function write(Tag $tag)
 {
     \tool::fprint("Writing ... " . get_called_class() . "@{$this->file->ftell()}");
     return $tag->save($this->file);
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:5,代码来源:Writer.php

示例11: createFrom

 public static function createFrom(Reader $file)
 {
     \tool::fprint("Reading ... " . get_called_class() . "::" . __FUNCTION__);
     return new static(TAG_String::readFrom($file), static::readFrom($file));
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:5,代码来源:TAG_Value.php

示例12: save

 public function save(SplFileObject $file)
 {
     \tool::fprint("Saving ... " . get_called_class());
     return $file->fwrite(Dictionary::mapName($this->id));
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:5,代码来源:TAG_End.php

示例13: save

 public function save(SplFileObject $file)
 {
     \tool::fprint("Saving ... " . get_called_class() . (isset($this->name) ? ":{$this->name}" : '') . "@{$file->ftell()}");
     return $file->fwrite(isset($this->name) ? Dictionary::mapName($this->id) . TAG_String::store($this->name) : '');
 }
开发者ID:anrdaemon,项目名称:minecraft-nbt,代码行数:5,代码来源:Tag.php


注:本文中的tool::fprint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。