More crap, some new discoveries, backtracking, annoyance.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3918 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -28,14 +28,6 @@ public class ObjectInputStream
|
||||
_source = source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a translation that should be used when writing objects.
|
||||
*/
|
||||
public function addTranslation (oldName :String, newName :String) :void
|
||||
{
|
||||
_translations[oldName] = newName;
|
||||
}
|
||||
|
||||
public function readObject () :Object
|
||||
//throws IOError
|
||||
{
|
||||
@@ -57,13 +49,8 @@ public class ObjectInputStream
|
||||
code *= -1;
|
||||
|
||||
// read in the class metadata
|
||||
var cname :String = readUTF();
|
||||
var cname :String = Translations.getFromServer(readUTF());
|
||||
Log.debug("read cname: " + cname);
|
||||
// if we have a translation, use it
|
||||
var tname :String = _translations[cname];
|
||||
if (tname != null) {
|
||||
cname = tname;
|
||||
}
|
||||
var streamer :Streamer = Streamer.getStreamerByJavaName(cname);
|
||||
|
||||
cmap = new ClassMapping(code, cname, streamer);
|
||||
@@ -215,9 +202,5 @@ public class ObjectInputStream
|
||||
|
||||
/** A map of short class code to ClassMapping info. */
|
||||
protected var _classMap :Array = new Array();
|
||||
|
||||
/** An collection of class name translations to use when unserializing
|
||||
* objects. */
|
||||
protected var _translations :SimpleMap = new SimpleMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,15 +15,6 @@ public class ObjectOutputStream
|
||||
_targ = targ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a classname translation for rewriting the names of objects
|
||||
* that we send to the server.
|
||||
*/
|
||||
public function addTranslation (oldName :String, newName :String) :void
|
||||
{
|
||||
_translations[oldName] = newName;
|
||||
}
|
||||
|
||||
public function writeObject (obj :Object) :void
|
||||
//throws IOError
|
||||
{
|
||||
@@ -35,7 +26,7 @@ public class ObjectOutputStream
|
||||
|
||||
var cname :String = ClassUtil.getClassName(obj);
|
||||
// look up the class mapping record
|
||||
var cmap :ClassMapping = _classMap[cname];
|
||||
var cmap :ClassMapping = (_classMap.get(cname) as ClassMapping);
|
||||
|
||||
// create a class mapping if we've not got one
|
||||
if (cmap == null) {
|
||||
@@ -48,18 +39,13 @@ public class ObjectOutputStream
|
||||
}
|
||||
|
||||
cmap = new ClassMapping(_nextCode++, cname, streamer);
|
||||
_classMap[cname] = cmap;
|
||||
_classMap.put(cname, cmap);
|
||||
|
||||
// TODO: if _nextCode blows short, log an error
|
||||
|
||||
// see if there's a translation we should use
|
||||
var tname :String = _translations[cname];
|
||||
if (tname != null) {
|
||||
cname = tname;
|
||||
}
|
||||
|
||||
writeShort(-cmap.code);
|
||||
writeUTF((streamer == null) ? cname : streamer.getJavaClassName());
|
||||
writeUTF((streamer == null) ? Translations.getToServer(cname)
|
||||
: streamer.getJavaClassName());
|
||||
|
||||
} else {
|
||||
writeShort(cmap.code);
|
||||
@@ -200,8 +186,5 @@ public class ObjectOutputStream
|
||||
|
||||
/** A map of classname to ClassMapping info. */
|
||||
protected var _classMap :SimpleMap = new SimpleMap();
|
||||
|
||||
/** A map of classname translations. */
|
||||
protected var _translations :SimpleMap = new SimpleMap();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,10 @@ public class Streamer
|
||||
{
|
||||
initStreamers();
|
||||
|
||||
if (jname.charAt(0) === "[") {
|
||||
// Oh ghod
|
||||
}
|
||||
|
||||
for each (var streamer :Streamer in _streamers) {
|
||||
if (streamer.getJavaClassName() === jname) {
|
||||
return streamer;
|
||||
@@ -86,7 +90,7 @@ public class Streamer
|
||||
if (obj is Array) {
|
||||
trace("Arrays not yet done. Crap!");
|
||||
/**
|
||||
var arr :Array = (obj as Array); // not strictly necessary
|
||||
var arr :Array = Array(obj); // not strictly necessary
|
||||
var length :int = arr.length;
|
||||
out.writeInt(length);
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user