Make writing List fields on Streamables possible from ActionScript again, and fix List reading and
writing in the code generated by GenActionScriptStreamableTask. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6199 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -29,6 +29,7 @@ import com.threerings.io.SimpleStreamableObject;
|
||||
import com.threerings.util.Long;
|
||||
import com.threerings.io.TypedArray;
|
||||
import flash.utils.ByteArray;
|
||||
import com.threerings.io.streamers.ArrayStreamer;
|
||||
// GENERATED PREAMBLE END
|
||||
|
||||
import com.threerings.util.Util;
|
||||
@@ -64,6 +65,7 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
bytes.writeByte(2);
|
||||
bytes.writeByte(3);
|
||||
ints = TypedArray.create(int, [1, 2, 3]);
|
||||
strings = TypedArray.create(String, ["one", "two", "three"]);
|
||||
}
|
||||
|
||||
public function equals (o :ASStreamableSubset) :Boolean
|
||||
@@ -73,7 +75,8 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
byte8 === o.byte8 && string1 === o.string1 && nullString1 === o.nullString1 &&
|
||||
Util.equals(bools, o.bools) && Util.equals(bytes, o.bytes) &&
|
||||
Util.equals(ints, o.ints) && Util.equals(nullBools, o.nullBools) &&
|
||||
Util.equals(nullBytes, o.nullBytes) && Util.equals(nullInts, o.nullInts);
|
||||
Util.equals(nullBytes, o.nullBytes) && Util.equals(nullInts, o.nullInts) &&
|
||||
Util.equals(strings, o.strings) && Util.equals(nullStrings, o.nullStrings);
|
||||
|
||||
}
|
||||
|
||||
@@ -94,6 +97,8 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
public var nullBools :TypedArray;
|
||||
public var nullBytes :ByteArray;
|
||||
public var nullInts :TypedArray;
|
||||
public var strings :TypedArray;
|
||||
public var nullStrings :TypedArray;
|
||||
|
||||
override public function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
@@ -114,8 +119,10 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
nullBools = ins.readField(TypedArray.getJavaType(Boolean));
|
||||
nullBytes = ins.readField(ByteArray);
|
||||
nullInts = ins.readField(TypedArray.getJavaType(int));
|
||||
strings = ins.readField(ArrayStreamer.INSTANCE);
|
||||
nullStrings = ins.readField(ArrayStreamer.INSTANCE);
|
||||
}
|
||||
|
||||
|
||||
override public function writeObject (out :ObjectOutputStream) :void
|
||||
{
|
||||
super.writeObject(out);
|
||||
@@ -135,6 +142,8 @@ public class ASStreamableSubset extends SimpleStreamableObject
|
||||
out.writeField(nullBools);
|
||||
out.writeField(nullBytes);
|
||||
out.writeField(nullInts);
|
||||
out.writeField(strings, ArrayStreamer.INSTANCE);
|
||||
out.writeField(nullStrings, ArrayStreamer.INSTANCE);
|
||||
}
|
||||
// GENERATED STREAMING END
|
||||
|
||||
|
||||
@@ -31,6 +31,11 @@ import asunit.framework.TestCase;
|
||||
|
||||
public class StreamableTest extends TestCase
|
||||
{
|
||||
public function StreamableTest (name:String = null)
|
||||
{
|
||||
super(name);
|
||||
}
|
||||
|
||||
public function testStreamingToSelf ():void
|
||||
{
|
||||
var sub:ASStreamableSubset = ASStreamableSubset.createWithJavaDefaults();
|
||||
@@ -49,7 +54,8 @@ public class StreamableTest extends TestCase
|
||||
var javaData:ByteArray = StringUtil.unhexlate(
|
||||
"ffff0024636f6d2e746872656572696e67732e696f2e415353747265616d61626c65537562736574" +
|
||||
"01000200000003000000000000000440a0000040180000000000000007080100036f6e6500010000" +
|
||||
"000301000101000000030102030100000003000000010000000200000003000000");
|
||||
"0003010001010000000301020301000000030000000100000002000000030000000100000003fffe" +
|
||||
"00106a6176612e6c616e672e537472696e6700036f6e650002000374776f00020005746872656500");
|
||||
var input:ObjectInputStream = new ObjectInputStream(javaData);
|
||||
var read :ASStreamableSubset = input.readObject(ASStreamableSubset);
|
||||
assertTrue(sub.equals(read));
|
||||
|
||||
Reference in New Issue
Block a user