| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * FileMode describes the modes in which a file can be opened. | 7 * FileMode describes the modes in which a file can be opened. |
| 8 */ | 8 */ |
| 9 class FileMode { | 9 class FileMode { |
| 10 static final READ = const FileMode(0); | 10 static final READ = const FileMode(0); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 * The [errorHandler] is called if the operation fails. | 181 * The [errorHandler] is called if the operation fails. |
| 182 */ | 182 */ |
| 183 void readAsBytes(); | 183 void readAsBytes(); |
| 184 | 184 |
| 185 /** | 185 /** |
| 186 * Synchronously read the entire file contents as a list of bytes. | 186 * Synchronously read the entire file contents as a list of bytes. |
| 187 */ | 187 */ |
| 188 List<int> readAsBytesSync(); | 188 List<int> readAsBytesSync(); |
| 189 | 189 |
| 190 /** | 190 /** |
| 191 * Read the entire file contents as text using the give [encoding] | 191 * Read the entire file contents as text using the given [encoding] |
| 192 * ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the encoding is | 192 * ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the encoding is |
| 193 * 'UTF-8'. | 193 * 'UTF-8'. |
| 194 * | 194 * |
| 195 * When the operation completes the [readAsTextHandler] is called | 195 * When the operation completes the [readAsTextHandler] is called |
| 196 * with the resulting string. The [errorHandler] is called if the | 196 * with the resulting string. The [errorHandler] is called if the |
| 197 * operation fails. | 197 * operation fails. |
| 198 */ | 198 */ |
| 199 void readAsText([String encoding]); | 199 void readAsText([String encoding]); |
| 200 | 200 |
| 201 /** | 201 /** |
| 202 * Synchronously read the entire file contents as text using the | 202 * Synchronously read the entire file contents as text using the |
| 203 * give [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the | 203 * given [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the |
| 204 * encoding is 'UTF-8'. | 204 * encoding is 'UTF-8'. |
| 205 */ | 205 */ |
| 206 String readAsTextSync([String encoding]); | 206 String readAsTextSync([String encoding]); |
| 207 | 207 |
| 208 /** | 208 /** |
| 209 * Read the entire file contents as lines of text using the give | 209 * Read the entire file contents as lines of text using the give |
| 210 * [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the | 210 * [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By default the |
| 211 * encoding is 'UTF-8'. | 211 * encoding is 'UTF-8'. |
| 212 * | 212 * |
| 213 * When the operation completes the [readAsLinesHandler] is called | 213 * When the operation completes the [readAsLinesHandler] is called |
| 214 * with the resulting string. The [errorHandler] is called if the | 214 * with the resulting string. The [errorHandler] is called if the |
| 215 * operation fails. | 215 * operation fails. |
| 216 */ | 216 */ |
| 217 void readAsLines(); | 217 void readAsLines(); |
| 218 | 218 |
| 219 /** | 219 /** |
| 220 * Synchronously read the entire file contents as lines of text | 220 * Synchronously read the entire file contents as lines of text |
| 221 * using the give [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By | 221 * using the given [encoding] ('UTF-8', 'ISO-8859-1', 'ASCII'). By |
| 222 * default the encoding is 'UTF-8'. | 222 * default the encoding is 'UTF-8'. |
| 223 */ | 223 */ |
| 224 List<String> readAsLinesSync([String encoding]); | 224 List<String> readAsLinesSync([String encoding]); |
| 225 | 225 |
| 226 /** | 226 /** |
| 227 * Get the name of the file. | 227 * Get the name of the file. |
| 228 */ | 228 */ |
| 229 String get name(); | 229 String get name(); |
| 230 | 230 |
| 231 /** | 231 /** |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 */ | 504 */ |
| 505 void set errorHandler(void handler(String error)); | 505 void set errorHandler(void handler(String error)); |
| 506 } | 506 } |
| 507 | 507 |
| 508 | 508 |
| 509 class FileIOException implements Exception { | 509 class FileIOException implements Exception { |
| 510 const FileIOException([String this.message = ""]); | 510 const FileIOException([String this.message = ""]); |
| 511 String toString() => "FileIOException: $message"; | 511 String toString() => "FileIOException: $message"; |
| 512 final String message; | 512 final String message; |
| 513 } | 513 } |
| OLD | NEW |