function readFile() {
var result, encoded, buffers = [];
- result = native_.callSync('File_readSync', data);
- if (native_.isFailure(result)) {
- setTimeout(function() {
- native_.callIfPossible(args.onerror, native_.getErrorObject(result));
- }, 0);
- return;
- }
- result = native_.getResultObject(result);
- if (result.length) {
- data.offset += data.length;
- }
+ var output = "";
+ do {
+ result = native_.callSync('File_readSync', data);
+ if (native_.isFailure(result)) {
+ setTimeout(function() {
+ native_.callIfPossible(args.onerror, native_.getErrorObject(result));
+ }, 0);
+ return;
+ }
+ result = native_.getResultObject(result);
+ if (result.length) {
+ data.offset += data.length;
+ }
+ output = output + result;
+ } while (result.length)
setTimeout(function() {
- native_.callIfPossible(args.onsuccess, result);
+ native_.callIfPossible(args.onsuccess, output);
}, 0);
}