Index: sdk/lib/io/file_impl.dart |
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart |
index e9403c2ae0fb9ac5b7cfc63f2b129ef85a863c5a..078999024b75f798800ff7b1ef9b981865a35879 100644 |
--- a/sdk/lib/io/file_impl.dart |
+++ b/sdk/lib/io/file_impl.dart |
@@ -479,12 +479,11 @@ class _File implements File { |
Future<List<int>> readAsBytes() { |
_ensureFileService(); |
Completer<List<int>> completer = new Completer<List<int>>(); |
- var chunks = new _BufferList(); |
+ var builder = new BytesBuilder(); |
openRead().listen( |
- (d) => chunks.add(d), |
+ (d) => builder.add(d), |
onDone: () { |
- var result = chunks.readBytes(); |
- completer.complete(result); |
+ completer.complete(builder.takeBytes()); |
}, |
onError: (e) { |
completer.completeError(e); |
@@ -495,13 +494,13 @@ class _File implements File { |
List<int> readAsBytesSync() { |
var opened = openSync(); |
- var chunks = new _BufferList(); |
+ var builder = new BytesBuilder(); |
var data; |
while ((data = opened.readSync(_BLOCK_SIZE)).length > 0) { |
- chunks.add(data); |
+ builder.add(data); |
} |
opened.closeSync(); |
- return chunks.readBytes(); |
+ return builder.takeBytes(); |
} |
Future<String> readAsString({Encoding encoding: Encoding.UTF_8}) { |