[jQuery] OT: FileStream.readObject with JS based AIR app

[jQuery] OT: FileStream.readObject with JS based AIR app


I'm trying to open a text file, and read it's contents with a JS based
AIR app. My code:
var loginFileName = 'app.login';
var loginFile =
air.File.applicationStorageDirectory.resolvePath(loginFileName);
var _fs = new air.FileStream();
_fs.open(loginFile, air.FileMode.READ);
var o = _fs.readObject();
As soon as it hits the readObject line it bombs with the following
error:
RangeError: Error #2006: The supplied index is out of bounds.
at app:/scripts/Login.js : 33
I know that the file is there, and that it's open for read because I
can swap out that line for this:
var o = _fs.readUTFBytes(_fs.bytesAvailable);
and it works just fine.
Anyone have any ideas what's happening?