From 62d613bf6448b7341d8663db452f0c78b4810305 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 23 Aug 2006 21:14:23 +0000 Subject: [PATCH] This was moved to ezgame/util and renamed the EZObjectMarshaller. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4339 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/util/FlashObjectMarshaller.as | 64 ------------------- 1 file changed, 64 deletions(-) delete mode 100644 src/as/com/threerings/util/FlashObjectMarshaller.as diff --git a/src/as/com/threerings/util/FlashObjectMarshaller.as b/src/as/com/threerings/util/FlashObjectMarshaller.as deleted file mode 100644 index ce9a1f1ca..000000000 --- a/src/as/com/threerings/util/FlashObjectMarshaller.as +++ /dev/null @@ -1,64 +0,0 @@ -package com.threerings.util { - -import flash.net.ObjectEncoding; - -import flash.system.ApplicationDomain; - -import flash.utils.ByteArray; -import flash.utils.Endian; - -import com.threerings.io.TypedArray; - -/** - * Utility methods for transferring flash properties via - * the presents dobj system. - */ -public class FlashObjectMarshaller -{ - public static function encode ( - obj :Object, encodeArrayElements :Boolean = true) :Object - { - if (obj == null) { - return null; - } - if (encodeArrayElements && obj is Array) { - var src :Array = (obj as Array); - var dest :TypedArray = TypedArray.create(ByteArray); - for each (var o :Object in src) { - dest.push(encode(o, false)); - } - return dest; - } - - // TODO: Our own encoding, that takes into account - // the ApplicationDomain - var bytes :ByteArray = new ByteArray(); - bytes.endian = Endian.BIG_ENDIAN; - bytes.objectEncoding = ObjectEncoding.AMF3; - bytes.writeObject(obj); - return bytes; - } - - public static function decode (encoded :Object) :Object - { - if (encoded == null) { - return null; - } - if (encoded is TypedArray) { - var src :TypedArray = (encoded as TypedArray); - var dest :Array = []; - for each (var b :ByteArray in src) { - dest.push(decode(b)); - } - return dest; - } - var bytes :ByteArray = (encoded as ByteArray); - - // TODO: Our own decoding, that takes into account - // the ApplicationDomain - bytes.endian = Endian.BIG_ENDIAN; - bytes.objectEncoding = ObjectEncoding.AMF3; - return bytes.readObject(); - } -} -}