public static function readData(FlashorbBinaryReader $reader, $context, $dataType) { $ctx = $context; $contextPassedAsNull = is_null($ctx); $dataTypePassedAsNull = is_null($dataType); if ($contextPassedAsNull) { $ctx = new ParseContext(0); } if ($dataTypePassedAsNull) { $type = $reader->readByte(); } else { $type = $dataType; } if ($contextPassedAsNull && $dataTypePassedAsNull || $ctx->getVersion() != 3) { $version = 1; } else { $version = 3; } if (LOGGING) { Log::log(LoggingConstants::SERIALIZATION, "Reading data type: {$type}, version: {$version}"); } $readers = null; //echo $ctx->getVersion(); exit; if ($version == 1) { $readers = self::getReadersV1(); } else { $readers = self::getReadersV3(); } return $readers[$type]->read($reader, $ctx); }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $refId = $reader->readVarInteger(); if (($refId & 0x1) == 0) { return $parseContext->getReference($refId >> 1); } $dateTime = $reader->readDouble(); $dateType = new DateType(new ORBDateTime($dateTime, 0)); $parseContext->addReference($dateType); return $dateType; }
public static function readString(FlashorbBinaryReader $reader, ParseContext $parseContext) { $len = $reader->readVarInteger(); if (($len & 0x1) == 0) { return $parseContext->getStringReference($len >> 1); } $str = $reader->readUTF($len >> 1); if (strlen($str) == 0) { return $str; } $parseContext->addStringReference($str); return $str; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $length = $reader->readInteger(); $array = array(); if (LOGGING) { Log::log(LoggingConstants::SERIALIZATION, "Reading array, size:" . $length); } $arrayType = new ArrayType($array); $parseContext->addReference($arrayType); for ($index = 0; $index < $length; $index++) { $array[] = AmfMessageFactory::readData($reader, $parseContext, null); } return $arrayType; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $len = $reader->readVarInteger(); if (($len & 0x1) == 0) { return $parseContext->getReference($len >> 1); } $len = $len >> 1; if ($len == 0) { return $this->parseString(""); } $xmlStr = $reader->readUTF($len); $xmlType = $this->parseString($xmlStr); $parseContext->addReference($xmlType); return $xmlType; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $capacity = $reader->readInteger(); $properties = array(); $anonymousObject = new AnonymousObject($properties); $parseContext->addReference($anonymousObject); while (TRUE) { $propName = $reader->readUTF(); $obj = AmfMessageFactory::readData($reader, $parseContext, null); if (is_null($obj)) { break; } $properties[$propName] = $obj; } return $anonymousObject; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $refId = $reader->readVarInteger(); if (($refId & 0x1) == 0) { return $parseContext->getReference($refId >> 1); } $bytes = $reader->readBytes($refId >> 1); $objArray = array(); $len = strlen($bytes); for ($i = 0; $i < $len; $i++) { $objArray[] = new NumberObject(ord($bytes[$i])); } $arrayType = new ArrayType($objArray); $parseContext->addReference($arrayType); return $arrayType; }
private function getClassInfo($refId, FlashorbBinaryReader $reader, ParseContext $parseContext) { if (($refId & 0x3) == 1) { return $parseContext->getClassInfoReference($refId >> 2); } $looseProps = ($refId & 0x8) == 8; $className = ReaderUtils::readString($reader, $parseContext); $classInfo = new ClassInfo($looseProps, $className); $propsCount = $refId >> 4; if (LOGGING) { Log::log(LoggingConstants::SERIALIZATION, "Readed class info, class: {$className}, property count:{$propsCount}"); } for ($i = 0; $i < $propsCount; $i++) { $classInfo->addProperty(ReaderUtils::readString($reader, $parseContext)); } $parseContext->addClassInfoReference($classInfo); return $classInfo; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $properties = array(); $anonymousObject = new AnonymousObject($properties); $parseContext->addReference($anonymousObject); while (true) { $propName = $reader->readUTF(); $obj = null; $dataType = $reader->readByte(); if ($dataType == Datatypes::REMOTEREFERENCE_DATATYPE_V1 && $propName != "nc") { $obj = 0; // must be an instance of Flash's Number } else { $obj = AmfMessageFactory::readData($reader, $parseContext, $dataType); } if (is_null($obj)) { break; } $properties[$propName] = $obj; } return $anonymousObject; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $refId = $reader->readVarInteger(); if (($refId & 0x1) == 0) { return $parseContext->getReference($refId >> 1); } $arraySize = $refId >> 1; $adaptingType = null; $container = null; while (true) { $str = ReaderUtils::readString($reader, $parseContext); if (is_null($str) || strlen($str) == 0) { break; } if (is_null($container)) { $container = array(); $adaptingType = new AnonymousObject($container); $parseContext->addReference($adaptingType); } $container[$str] = AmfMessageFactory::readData($reader, $parseContext, null); } if (is_null($adaptingType)) { $container = array(); $adaptingType = new ArrayType($container); $parseContext->addReference($adaptingType); for ($i = 0; $i < $arraySize; $i++) { $container[$i] = AmfMessageFactory::readData($reader, $parseContext, null); } } else { for ($i = 0; $i < $arraySize; $i++) { $obj = AmfMessageFactory::readData($reader, $parseContext, null); $container[(string) $i] = $obj; } } return $adaptingType; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $pointer = $reader->readUnsignedShort(); return $parseContext->getReference($pointer); }
public function read(DOMNode $element, ParseContext $parseContext) { /*int*/ $refID = trim(strtolower($element->textContent)); return $parseContext->getReference($refID); }
public static function readData6($dataType, FlashorbBinaryReader $reader, ParseContext $parseContext, $readers) { if (LOGGING) { Log::log(ILoggingConstants . DEBUG, "5: The version is " . $parseContext->getVersion()); } return $readers[$dataType]->read($reader, $parseContext); }