| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 interface File factory _File { | 5 interface File factory _File { |
| 6 /** | 6 /** |
| 7 * Create a File object. | 7 * Create a File object. |
| 8 */ | 8 */ |
| 9 File(String name); | 9 File(String name); |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 void create(); | 29 void create(); |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Synchronously create the file. Existing files are left untouched | 32 * Synchronously create the file. Existing files are left untouched |
| 33 * by create. Calling create on an existing file might fail if there | 33 * by create. Calling create on an existing file might fail if there |
| 34 * are restrictive permissions on the file. | 34 * are restrictive permissions on the file. |
| 35 */ | 35 */ |
| 36 void createSync(); | 36 void createSync(); |
| 37 | 37 |
| 38 /** | 38 /** |
| 39 * Delete the file. The [deleteHandler] is called when the file has |
| 40 * been successfully deleted. The [errorHandler] is called if the |
| 41 * file cannot be deleted. |
| 42 */ |
| 43 void delete(); |
| 44 |
| 45 /** |
| 46 * Synchronously delete the file. |
| 47 */ |
| 48 void deleteSync(); |
| 49 |
| 50 /** |
| 39 * Open the file for random access operations. When the file is | 51 * Open the file for random access operations. When the file is |
| 40 * opened the openHandler is called. Opened files must be closed | 52 * opened the openHandler is called. Opened files must be closed |
| 41 * using the [close] method. By default writable is false. | 53 * using the [close] method. By default writable is false. |
| 42 */ | 54 */ |
| 43 void open([bool writable]); | 55 void open([bool writable]); |
| 44 | 56 |
| 45 /** | 57 /** |
| 46 * Synchronously open the file for random access operations. Opened | 58 * Synchronously open the file for random access operations. Opened |
| 47 * files must be closed using the [close] method. By default | 59 * files must be closed using the [close] method. By default |
| 48 * writable is false. | 60 * writable is false. |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 FileOutputStream openOutputStream(); | 207 FileOutputStream openOutputStream(); |
| 196 | 208 |
| 197 /** | 209 /** |
| 198 * Get the name of the file. | 210 * Get the name of the file. |
| 199 */ | 211 */ |
| 200 String get name(); | 212 String get name(); |
| 201 | 213 |
| 202 // Event handlers. | 214 // Event handlers. |
| 203 void set existsHandler(void handler(bool exists)); | 215 void set existsHandler(void handler(bool exists)); |
| 204 void set createHandler(void handler()); | 216 void set createHandler(void handler()); |
| 217 void set deleteHandler(void handler()); |
| 205 void set openHandler(void handler()); | 218 void set openHandler(void handler()); |
| 206 void set closeHandler(void handler()); | 219 void set closeHandler(void handler()); |
| 207 void set readByteHandler(void handler(int byte)); | 220 void set readByteHandler(void handler(int byte)); |
| 208 void set readListHandler(void handler(int read)); | 221 void set readListHandler(void handler(int read)); |
| 209 void set noPendingWriteHandler(void handler()); | 222 void set noPendingWriteHandler(void handler()); |
| 210 void set positionHandler(void handler(int position)); | 223 void set positionHandler(void handler(int position)); |
| 211 void set setPositionHandler(void handler()); | 224 void set setPositionHandler(void handler()); |
| 212 void set lengthHandler(void handler(int length)); | 225 void set lengthHandler(void handler(int length)); |
| 213 void set flushHandler(void handler()); | 226 void set flushHandler(void handler()); |
| 214 void set fullPathHandler(void handler(String path)); | 227 void set fullPathHandler(void handler(String path)); |
| 215 void set errorHandler(void handler(String error)); | 228 void set errorHandler(void handler(String error)); |
| 216 } | 229 } |
| 217 | 230 |
| 218 | 231 |
| 219 interface FileInputStream extends InputStream { | 232 interface FileInputStream extends InputStream { |
| 220 void close(); | 233 void close(); |
| 221 } | 234 } |
| 222 | 235 |
| 223 | 236 |
| 224 interface FileOutputStream extends OutputStream { | 237 interface FileOutputStream extends OutputStream { |
| 225 } | 238 } |
| 226 | 239 |
| 227 | 240 |
| 228 class FileIOException implements Exception { | 241 class FileIOException implements Exception { |
| 229 const FileIOException([String this.message = ""]); | 242 const FileIOException([String this.message = ""]); |
| 230 String toString() => "FileIOException: $message"; | 243 String toString() => "FileIOException: $message"; |
| 231 final String message; | 244 final String message; |
| 232 } | 245 } |
| OLD | NEW |