Chromium Code Reviews| Index: runtime/bin/file.dart |
| diff --git a/runtime/bin/file.dart b/runtime/bin/file.dart |
| index 477476861ae4f0f77aaff631126b876f0757818a..b4dcbe41fcb0688b24dfe714af02abcbb1765a65 100644 |
| --- a/runtime/bin/file.dart |
| +++ b/runtime/bin/file.dart |
| @@ -49,19 +49,61 @@ interface File factory _File { |
| /** |
| * Open the file for random access operations. When the file is |
| - * opened the openHandler is called. Opened files must be closed |
| - * using the [close] method. By default writable is false. |
| + * opened the openHandler is called with the resulting |
| + * RandomAccessFile. RandomAccessFiles must be closed using the |
| + * close method. By default writable is false. |
| */ |
| void open([bool writable]); |
| /** |
| - * Synchronously open the file for random access operations. Opened |
| - * files must be closed using the [close] method. By default |
| - * writable is false. |
| + * Synchronously open the file for random access operations. The |
| + * result is a RandomAccessFile on which random access operations |
| + * can be performed. Opened RandomAccessFiles must be closed using |
| + * the close method. By default writable is false. |
| */ |
| - void openSync([bool writable]); |
| + RandomAccessFile openSync([bool writable]); |
| /** |
| + * Get the canonical full path corresponding to the file name. The |
| + * [fullPathHandler] is called when the fullPath operation |
| + * completes. |
| + */ |
| + String fullPath(); |
| + |
| + /** |
| + * Synchronously get the canonical full path corresponding to the file name. |
| + */ |
| + String fullPathSync(); |
| + |
| + /** |
| + * Create a new independent input stream for the file. The file |
| + * input stream must be closed when no longer used. |
|
Søren Gjesse
2011/12/08 17:25:58
Maybe add "to free up system resources".
Mads Ager (google)
2011/12/08 19:37:01
Done.
|
| + */ |
| + FileInputStream openInputStream(); |
| + |
| + /** |
| + * Creates a new independent output stream for the file. The file |
| + * output stream must be closed when no longer used. |
|
Søren Gjesse
2011/12/08 17:25:58
Ditto.
Mads Ager (google)
2011/12/08 19:37:01
Done.
|
| + */ |
| + FileOutputStream openOutputStream(); |
| + |
| + /** |
| + * Get the name of the file. |
| + */ |
| + String get name(); |
| + |
| + // Event handlers. |
| + void set existsHandler(void handler(bool exists)); |
| + void set createHandler(void handler()); |
| + void set deleteHandler(void handler()); |
| + void set openHandler(void handler(RandomAccessFile openedFile)); |
| + void set fullPathHandler(void handler(String path)); |
| + void set errorHandler(void handler(String error)); |
| +} |
| + |
| + |
| +interface RandomAccessFile { |
| + /** |
| * Close the file. When the file is closed the closeHandler is |
| * called. |
| */ |
| @@ -194,39 +236,10 @@ interface File factory _File { |
| void flushSync(); |
| /** |
| - * Get the canonical full path corresponding to the file name. The |
| - * [fullPathHandler] is called when the fullPath operation |
| - * completes. |
| - */ |
| - String fullPath(); |
| - |
| - /** |
| - * Synchronously get the canonical full path corresponding to the file name. |
| - */ |
| - String fullPathSync(); |
| - |
| - /** |
| - * Create a new independent input stream for the file. The file |
| - * input stream must be closed when no longer used. |
| - */ |
| - FileInputStream openInputStream(); |
| - |
| - /** |
| - * Creates a new independent output stream for the file. The file |
| - * output stream must be closed when no longer used. |
| - */ |
| - FileOutputStream openOutputStream(); |
| - |
| - /** |
| * Get the name of the file. |
| */ |
| String get name(); |
| - // Event handlers. |
| - void set existsHandler(void handler(bool exists)); |
| - void set createHandler(void handler()); |
| - void set deleteHandler(void handler()); |
| - void set openHandler(void handler()); |
| void set closeHandler(void handler()); |
| void set readByteHandler(void handler(int byte)); |
| void set readListHandler(void handler(int read)); |
| @@ -236,7 +249,6 @@ interface File factory _File { |
| void set truncateHandler(void handler()); |
| void set lengthHandler(void handler(int length)); |
| void set flushHandler(void handler()); |
| - void set fullPathHandler(void handler(String path)); |
| void set errorHandler(void handler(String error)); |
| } |