Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1190)

Unified Diff: sdk/lib/io/http_body_impl.dart

Issue 18031023: Remove _BufferList from dart:io and now use BytesBuilder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use takeBytes not toBytes. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/io/http_body_impl.dart
diff --git a/sdk/lib/io/http_body_impl.dart b/sdk/lib/io/http_body_impl.dart
index f81198d2f3be7df70e9dafc02385d5d81de611a8..2eaf07bd791b9e66290e04a28621b464edb2929f 100644
--- a/sdk/lib/io/http_body_impl.dart
+++ b/sdk/lib/io/http_body_impl.dart
@@ -44,10 +44,10 @@ class _HttpBodyHandler {
Future<HttpBody> asBinary() {
return stream
- .fold(new _BufferList(), (buffer, data) => buffer..add(data))
- .then((buffer) => new _HttpBody(contentType,
- "binary",
- buffer.readBytes()));
+ .fold(new BytesBuilder(), (builder, data) => builder..add(data))
+ .then((builder) => new _HttpBody(contentType,
+ "binary",
+ builder.takeBytes()));
}
Future<HttpBody> asText(Encoding defaultEncoding) {
@@ -76,8 +76,8 @@ class _HttpBodyHandler {
.then((b) => b.toString());
} else {
future = multipart
- .fold(new _BufferList(), (b, d) => b..add(d))
- .then((b) => b.readBytes());
+ .fold(new BytesBuilder(), (b, d) => b..add(d))
+ .then((b) => b.takeBytes());
}
return future.then((data) {
var filename =

Powered by Google App Engine
This is Rietveld 408576698