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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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/directory_impl.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/file.dart
diff --git a/sdk/lib/io/file.dart b/sdk/lib/io/file.dart
index 53a348c5033a68674a48480ccad6bb5849aee4cf..e307ff59d99cee21ae8fda5bba3a723945565e79 100644
--- a/sdk/lib/io/file.dart
+++ b/sdk/lib/io/file.dart
@@ -19,11 +19,14 @@ class FileMode {
/**
* [File] objects are references to files.
*
- * To operate on the underlying file data you need to either get
- * streams using [openInputStream] and [openOutputStream] or open the
- * file for random access operations using [open].
+ * To operate on the underlying file data there are two options:
+ *
+ * * use streaming by getting a [Stream] for the contents of the file
+ * with [openRead] and by getting a [IOSink] for
+ * writing contents to the file using [openWrite], or
+ * * open the file for random access operations using [open].
*/
-abstract class File {
+abstract class File extends FileSystemEntity {
/**
* Create a File object.
*/
@@ -151,26 +154,27 @@ abstract class File {
String fullPathSync();
/**
- * Create a new independent input stream for the file. The file
- * input stream must be closed when no longer used to free up system
- * resources.
+ * Create a new independent [Stream] for the contents of this
+ * file.
+ *
+ * In order to make sure that system resources are freed, the stream
+ * must be read to completion or the subscription on the stream must
+ * be cancelled.
*/
- InputStream openInputStream();
+ Stream<List<int>> openRead();
+
/**
- * Creates a new independent output stream for the file. The file
- * output stream must be closed when no longer used to free up
+ * Creates a new independent [IOSink] for the file. The
+ * stream consumer must be closed when no longer used to free up
* system resources.
*
- * An output stream can be opened in two modes:
- *
- * FileMode.WRITE: create the stream and truncate the underlying
- * file to length zero.
+ * A IOSink can be opened for a file in two modes:
*
- * FileMode.APPEND: create the stream and set the position to the end of
- * the underlying file.
+ * * FileMode.WRITE: truncates the underlying file to length zero.
+ * * FileMode.APPEND: sets the position to the end of the underlying file.
*/
- OutputStream openOutputStream([FileMode mode = FileMode.WRITE]);
+ IOSink<File> openWrite([FileMode mode = FileMode.WRITE]);
/**
* Read the entire file contents as a list of bytes. Returns a
« no previous file with comments | « sdk/lib/io/directory_impl.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698