Chromium Code Reviews| Index: runtime/bin/file.dart |
| diff --git a/runtime/bin/file.dart b/runtime/bin/file.dart |
| index e7f8e0ccd469aa1b476a18177b0ec4eaec018406..a507235e9497418f41b941e722e8763f3a7f85ca 100644 |
| --- a/runtime/bin/file.dart |
| +++ b/runtime/bin/file.dart |
| @@ -22,16 +22,16 @@ class FileMode { |
| * streams using [openInputStream] and [openOutputStream] or open the |
| * file for random access operations using [open]. |
| */ |
| -interface File default _File { |
| +abstract class File { |
| /** |
| * Create a File object. |
| */ |
| - File(String name); |
| + factory File(String name) => new _File(name); |
| /** |
| * Create a File object from a Path object. |
| */ |
| - File.fromPath(Path path); |
| + factory File.fromPath(Path path) => new _File.fromPath(path); |
| /** |
| * Check if the file exists. Does not block and returns a |
| @@ -128,7 +128,7 @@ interface File default _File { |
| * |
| * The default value for [mode] is [:FileMode.READ:]. |
|
Søren Gjesse
2012/09/18 09:34:16
No need for documentation of the default value.
Mads Ager (google)
2012/09/18 10:46:39
Done.
|
| */ |
| - Future<RandomAccessFile> open([FileMode mode]); |
| + Future<RandomAccessFile> open([FileMode mode = FileMode.READ]); |
| /** |
| * Synchronously open the file for random access operations. The |
| @@ -140,7 +140,7 @@ interface File default _File { |
| * |
| * See [open] for information on the [mode] argument. |
| */ |
| - RandomAccessFile openSync([FileMode mode]); |
| + RandomAccessFile openSync([FileMode mode = FileMode.READ]); |
| /** |
| * Get the canonical full path corresponding to the file name. |
| @@ -175,7 +175,7 @@ interface File default _File { |
| * |
| * By default the mode is FileMode.WRITE. |
|
Søren Gjesse
2012/09/18 09:34:16
Ditto.
Mads Ager (google)
2012/09/18 10:46:39
Done.
|
| */ |
| - OutputStream openOutputStream([FileMode mode]); |
| + OutputStream openOutputStream([FileMode mode = FileMode.WRITE]); |
| /** |
| * Read the entire file contents as a list of bytes. Returns a |
| @@ -196,13 +196,13 @@ interface File default _File { |
| * Returns a [:Future<String>:] that completes with the string once |
| * the file contents has been read. |
| */ |
| - Future<String> readAsText([Encoding encoding]); |
| + Future<String> readAsText([Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Synchronously read the entire file contents as text using the |
| * given [encoding]. The default encoding is [:Encoding.UTF_8:]. |
|
Søren Gjesse
2012/09/18 09:34:16
Ditto.
Mads Ager (google)
2012/09/18 10:46:39
Done.
|
| */ |
| - String readAsTextSync([Encoding encoding]); |
| + String readAsTextSync([Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Read the entire file contents as lines of text using the give |
| @@ -211,14 +211,14 @@ interface File default _File { |
| * Returns a [:Future<List<String>>:] that completes with the lines |
| * once the file contents has been read. |
| */ |
| - Future<List<String>> readAsLines([Encoding encoding]); |
| + Future<List<String>> readAsLines([Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Synchronously read the entire file contents as lines of text |
| * using the given [encoding] The default encoding is |
| * [:Encoding.UTF_8:]. |
|
Søren Gjesse
2012/09/18 09:34:16
Ditto.
Mads Ager (google)
2012/09/18 10:46:39
Done.
|
| */ |
| - List<String> readAsLinesSync([Encoding encoding]); |
| + List<String> readAsLinesSync([Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Get the name of the file. |
| @@ -232,7 +232,7 @@ interface File default _File { |
| * file. [RandomAccessFile] objects are obtained by calling the |
| * [:open:] method on a [File] object. |
| */ |
| -interface RandomAccessFile { |
| +abstract class RandomAccessFile { |
| /** |
| * Close the file. Returns a [:Future<RandomAccessFile>:] that |
| * completes with this RandomAccessFile when it has been closed. |
| @@ -300,14 +300,16 @@ interface RandomAccessFile { |
| * [:Future<RandomAccessFile>:] that completes with this |
| * RandomAccessFile when the write completes. |
| */ |
| - Future<RandomAccessFile> writeString(String string, [Encoding encoding]); |
| + Future<RandomAccessFile> writeString(String string, |
| + [Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Synchronously write a single string to the file using the given |
| * [encoding]. Returns the number of characters successfully |
| * written. The default encoding is UTF-8 - [:Encoding.UTF_8:]. |
|
Søren Gjesse
2012/09/18 09:34:16
Ditto.
Mads Ager (google)
2012/09/18 10:46:39
Done.
|
| */ |
| - int writeStringSync(String string, [Encoding encoding]); |
| + int writeStringSync(String string, |
| + [Encoding encoding = Encoding.UTF_8]); |
| /** |
| * Get the current byte position in the file. Returns a |