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

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

Issue 14028017: Remove .writeStream, .consume and rewrite IOSink to correctly implement a (sane) well-defined behav… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review comments. Created 7 years, 8 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
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/http.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file_impl.dart
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 65f7adfb75586a616a00fd4efb56aed66726a9ea..83952b17ee5a6e747c0fe877ca6cc8fa171cb272 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -161,10 +161,6 @@ class _FileStreamConsumer extends StreamConsumer<List<int>> {
_openFuture = new Future.immediate(_File._openStdioSync(fd));
}
- Future<File> consume(Stream<List<int>> stream) {
- return addStream(stream).then((_) => close());
- }
-
Future<File> addStream(Stream<List<int>> stream) {
Completer<File> completer = new Completer<File>();
_openFuture
@@ -476,15 +472,15 @@ class _File extends _FileBase implements File {
return new _FileStream(_path);
}
- IOSink<File> openWrite({FileMode mode: FileMode.WRITE,
- Encoding encoding: Encoding.UTF_8}) {
+ IOSink openWrite({FileMode mode: FileMode.WRITE,
+ Encoding encoding: Encoding.UTF_8}) {
if (mode != FileMode.WRITE &&
mode != FileMode.APPEND) {
throw new FileIOException(
"Wrong FileMode. Use FileMode.WRITE or FileMode.APPEND");
}
var consumer = new _FileStreamConsumer(this, mode);
- return new IOSink<File>(consumer, encoding: encoding);
+ return new IOSink(consumer, encoding: encoding);
}
Future<List<int>> readAsBytes() {
@@ -556,7 +552,7 @@ class _File extends _FileBase implements File {
Future<File> writeAsBytes(List<int> bytes,
{FileMode mode: FileMode.WRITE}) {
try {
- IOSink<File> sink = openWrite(mode: mode);
+ IOSink sink = openWrite(mode: mode);
sink.add(bytes);
sink.close();
return sink.done.then((_) => this);;
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698