Some more progress.
I still need to work on the Streaming, but I've figured out how to do a bit of introspection which will be necessary when streaming an array. Started working on the client classes, did ClientObserver and SessionObserver stuff using flash's event notification system. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3846 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package com.threerings.io.streamers {
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
import com.threerings.io.Streamer;
|
||||
|
||||
/**
|
||||
* A Streamer for Array objects.
|
||||
*/
|
||||
public class ArrayStreamer extends Streamer
|
||||
{
|
||||
public function ArrayStreamer ()
|
||||
{
|
||||
super(Array);
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
{
|
||||
return new Array(ins.readInt());
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream,
|
||||
useWriter :Boolean) :void
|
||||
{
|
||||
var arr :Array = (obj as Array);
|
||||
out.writeInt(arr.length);
|
||||
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||
out.writeObject(arr[ii]);
|
||||
}
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream,
|
||||
useReader :Boolean) :void
|
||||
{
|
||||
var arr :Array = (obj as Array);
|
||||
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||
arr[ii] = ins.readObject();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user