diff --git a/src/as/com/threerings/io/ObjectInputStream.as b/src/as/com/threerings/io/ObjectInputStream.as index 1a9c81b6f..8d910a108 100644 --- a/src/as/com/threerings/io/ObjectInputStream.as +++ b/src/as/com/threerings/io/ObjectInputStream.as @@ -202,8 +202,7 @@ public class ObjectInputStream * Read bytes into the byte array. If length is not specified, then * enough bytes to fill the array (from the offset) are read. */ - public function readBytes (bytes :ByteArray, offset :uint = 0, - length :int = -1) :void + public function readBytes (bytes :ByteArray, offset :int = 0, length :int = -1) :void //throws IOError { // if no length specified then fill the ByteArray diff --git a/src/as/com/threerings/io/ObjectOutputStream.as b/src/as/com/threerings/io/ObjectOutputStream.as index a8cbb9d60..0901c01b7 100644 --- a/src/as/com/threerings/io/ObjectOutputStream.as +++ b/src/as/com/threerings/io/ObjectOutputStream.as @@ -164,11 +164,15 @@ public class ObjectOutputStream _targ.writeByte(value); } - public function writeBytes (bytes :ByteArray, offset :uint=0, - length :uint = 0) :void + public function writeBytes (bytes :ByteArray, offset :int = 0, length :int = -1) :void //throws IOError { - _targ.writeBytes(bytes, offset, length); + if (length == -1) { + length = bytes.length - offset; + } + if (length > 0) { + _targ.writeBytes(bytes, offset, length); + } } public function writeDouble (value :Number) :void