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:
Ray Greenwell
2006-03-07 03:49:33 +00:00
parent e5c65b95b5
commit d8276bb4a9
12 changed files with 138 additions and 101 deletions
+4 -21
View File
@@ -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();
}
}