Chromium Code Reviews| Index: runtime/bin/file.dart |
| diff --git a/runtime/bin/file.dart b/runtime/bin/file.dart |
| index 9728ab7cd92d338429781fb34974419b3fc74f25..bc96658b16786a6e64185a741a51912379d0e7c4 100644 |
| --- a/runtime/bin/file.dart |
| +++ b/runtime/bin/file.dart |
| @@ -163,38 +163,37 @@ interface File default _File { |
| List<int> readAsBytesSync(); |
| /** |
| - * Read the entire file contents as text using the given [encoding] |
| - * ('UTF-8', 'ISO-8859-1', 'ASCII'). |
| + * Read the entire file contents as text using the given |
| + * [encoding]. The default encoding is UTF-8 - [:Encodings.UTF_8:]. |
| * |
| * When the operation completes the callback is called. The |
| * [onError] function registered on the file object is called if the |
| * operation fails. |
| */ |
| - void readAsText(String encoding, void callback(String text)); |
| + void readAsText(Encoding encoding, void callback(String text)); |
| /** |
| * Synchronously read the entire file contents as text using the |
| - * given [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the |
| - * encoding is 'UTF-8'. |
| + * given [encoding]. The default encoding is UTF-8 - [:Encodings.UTF_8:]. |
| */ |
| - String readAsTextSync([String encoding]); |
| + String readAsTextSync([Encoding encoding]); |
| /** |
| * Read the entire file contents as lines of text using the give |
| - * [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). |
| + * [encoding]. The default encoding is UTF-8 - [:Encodings.UTF_8:]. |
| * |
| * When the operation completes the callback is called. The |
| * [onError] function registered on the file object is called if the |
| * operation fails. |
| */ |
| - void readAsLines(String encoding, void callback(List<String> lines)); |
| + void readAsLines(Encoding encoding, void callback(List<String> lines)); |
| /** |
| * Synchronously read the entire file contents as lines of text |
| - * using the given [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By |
| - * default the encoding is 'UTF-8'. |
| + * using the given [encoding] The default encoding is UTF-8 - |
| + * [:Encodings.UTF_8:]. |
| */ |
| - List<String> readAsLinesSync([String encoding]); |
| + List<String> readAsLinesSync([Encoding encoding]); |
| /** |
| * Get the name of the file. |
| @@ -276,19 +275,21 @@ interface RandomAccessFile { |
| int writeListSync(List<int> buffer, int offset, int bytes); |
| /** |
| - * Write a string to the file. If the string cannot be written the |
| - * [onError] is called. When all pending write operations have |
| - * finished [onNoPendingWrites] is called. |
| + * Write a string to the file using the given [encoding]. If the |
| + * string cannot be written the [onError] is called. The default |
|
Mads Ager (google)
2012/03/09 11:22:50
This is my fault, could you fix it? ;-)
the [onEr
Søren Gjesse
2012/03/09 13:49:25
Done.
|
| + * encoding is UTF-8 - [:Encodings.UTF_8:]. |
| + * |
| + * When all pending write operations have finished |
| + * [onNoPendingWrites] is called. |
| */ |
| - // TODO(ager): writeString should take an encoding. |
| - void writeString(String string); |
| + void writeString(String string, [Encoding encoding]); |
| /** |
| - * Synchronously write a single string to the file. Returns the number |
| - * of characters successfully written. |
| + * 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 - [:Encodings.UTF_8:]. |
| */ |
| - // TODO(ager): writeStringSync should take an encoding. |
| - int writeStringSync(String string); |
| + int writeStringSync(String string, [Encoding encoding]); |
| /** |
| * Get the current byte position in the file. When the operation |