public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $refId = $reader->readVarInteger(); if (($refId & 0x1) == 0) { return $parseContext->getReference($refId >> 1); } $classInfo = $this->getClassInfo($refId, $reader, $parseContext); $props = array(); $obj = new AnonymousObject($props); $returnValue = $obj; if (!is_null($classInfo->getClassName()) && strlen($classInfo->getClassName()) > 0) { $returnValue = new NamedObject($classInfo->getClassName(), $obj); } $parseContext->addReference($returnValue); $propCount = $classInfo->getPropertyCount(); for ($i = 0; $i < $propCount; $i++) { $props[$classInfo->getProperty($i)] = AmfMessageFactory::readData($reader, $parseContext, null); } if ($classInfo->getLooseProps()) { while (TRUE) { $propName = ReaderUtils::readString($reader, $parseContext); if (is_null($propName) || strlen($propName) == 0) { break; } $props[$propName] = AmfMessageFactory::readData($reader, $parseContext, null); } } return $returnValue; }
public function read(FlashorbBinaryReader $reader, ParseContext $parseContext) { $objectName = $reader->readUTF(); $reference = AmfMessageFactory::readData($reader, $parseContext, null); if (is_null($reference)) { return null; } $hostingEnvironmentID = $reader->readUTF(); return new RemoteReferenceObject($reference); }
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) { $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; }
private static function getReadersV3() { if (is_null(self::$s_readersV3)) { self::$s_readersV3 = array(); self::$s_readersV3[Datatypes::UNKNOWN_DATATYPE_V3] = new UndefinedTypeReader(); self::$s_readersV3[Datatypes::NULL_DATATYPE_V3] = new NullReader(); self::$s_readersV3[Datatypes::BOOLEAN_DATATYPE_FALSEV3] = new BooleanReader(FALSE); self::$s_readersV3[Datatypes::BOOLEAN_DATATYPE_TRUEV3] = new BooleanReader(TRUE); self::$s_readersV3[Datatypes::INTEGER_DATATYPE_V3] = new IntegerReader(); self::$s_readersV3[Datatypes::DOUBLE_DATATYPE_V3] = new NumberReader(); self::$s_readersV3[Datatypes::UTFSTRING_DATATYPE_V3] = new V3StringReader(); self::$s_readersV3[Datatypes::XML_DATATYPE_V3] = new V3XmlReader(); self::$s_readersV3[Datatypes::DATE_DATATYPE_V3] = new V3DateReader(); self::$s_readersV3[Datatypes::ARRAY_DATATYPE_V3] = new V3ArrayReader(); self::$s_readersV3[Datatypes::OBJECT_DATATYPE_V3] = new V3ObjectReader(); self::$s_readersV3[Datatypes::LONGXML_DATATYPE_V3] = new V3XmlReader(); self::$s_readersV3[Datatypes::BYTEARRAY_DATATYPE_V3] = new V3ByteArrayReader(); } return self::$s_readersV3; }
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) { return AmfMessageFactory::readData($reader, new ParseContext(3), null); }