Well, it compiles.
It's not functional, there are still large holes in the implementation. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3868 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -14,12 +14,13 @@ public class ArrayStreamer extends Streamer
|
||||
super(Array, "[Ljava.lang.Object");
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
public override function createObject (ins :ObjectInputStream) :Object
|
||||
{
|
||||
return new Array(ins.readInt());
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream) :void
|
||||
public override function writeObject (obj :Object, out :ObjectOutputStream)
|
||||
:void
|
||||
{
|
||||
var arr :Array = (obj as Array);
|
||||
out.writeInt(arr.length);
|
||||
@@ -28,7 +29,8 @@ public class ArrayStreamer extends Streamer
|
||||
}
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream) :void
|
||||
public override function readObject (obj :Object, ins :ObjectInputStream)
|
||||
:void
|
||||
{
|
||||
var arr :Array = (obj as Array);
|
||||
for (var ii :int = 0; ii < arr.length; ii++) {
|
||||
|
||||
@@ -16,21 +16,23 @@ public class ByteArrayStreamer extends Streamer
|
||||
super(ByteArray, "[B"); // yes, that's the Java class for a byte[].
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
public override function createObject (ins :ObjectInputStream) :Object
|
||||
{
|
||||
var bytes :ByteArray = new ByteArray();
|
||||
bytes.length = ins.readInt();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream) :void
|
||||
public override function writeObject (obj :Object, out :ObjectOutputStream)
|
||||
:void
|
||||
{
|
||||
var bytes :ByteArray = (obj as ByteArray);
|
||||
out.writeInt(bytes.length);
|
||||
out.writeBytes(bytes);
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream) :void
|
||||
public override function readObject (obj :Object, ins :ObjectInputStream)
|
||||
:void
|
||||
{
|
||||
var bytes :ByteArray = (obj as ByteArray);
|
||||
ins.readBytes(bytes, 0, bytes.length);
|
||||
|
||||
@@ -14,18 +14,20 @@ public class IntStreamer extends Streamer
|
||||
super(int, "java.lang.Integer");
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
public override function createObject (ins :ObjectInputStream) :Object
|
||||
{
|
||||
return ins.readInt();
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream) :void
|
||||
public override function writeObject (obj :Object, out :ObjectOutputStream)
|
||||
:void
|
||||
{
|
||||
var i :int = (obj as int);
|
||||
out.writeInt(i);
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream) :void
|
||||
public override function readObject (obj :Object, ins :ObjectInputStream)
|
||||
:void
|
||||
{
|
||||
// nothing here, the int is fully read in createObject()
|
||||
}
|
||||
|
||||
@@ -14,18 +14,20 @@ public class NumberStreamer extends Streamer
|
||||
super(Number, "java.lang.Double");
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
public override function createObject (ins :ObjectInputStream) :Object
|
||||
{
|
||||
return ins.readDouble();
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream) :void
|
||||
public override function writeObject (obj :Object, out :ObjectOutputStream)
|
||||
:void
|
||||
{
|
||||
var n :Number = (obj as Number);
|
||||
out.writeDouble(n);
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream) :void
|
||||
public override function readObject (obj :Object, ins :ObjectInputStream)
|
||||
:void
|
||||
{
|
||||
// nothing here, the Number is fully read in createObject()
|
||||
}
|
||||
|
||||
@@ -14,18 +14,20 @@ public class StringStreamer extends Streamer
|
||||
super(String, "java.lang.String");
|
||||
}
|
||||
|
||||
public override function createObject (ins :ObjectInputStream) :*
|
||||
public override function createObject (ins :ObjectInputStream) :Object
|
||||
{
|
||||
return ins.readUTF();
|
||||
}
|
||||
|
||||
public override function writeObject (obj :*, out :ObjectOutputStream) :void
|
||||
public override function writeObject (obj :Object, out :ObjectOutputStream)
|
||||
:void
|
||||
{
|
||||
var s :String = (obj as String);
|
||||
out.writeUTF(s);
|
||||
}
|
||||
|
||||
public override function readObject (obj :*, ins :ObjectInputStream) :void
|
||||
public override function readObject (obj :Object, ins :ObjectInputStream)
|
||||
:void
|
||||
{
|
||||
// nothing here, the String is fully read in createObject()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user