Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Side by Side Diff: runtime/bin/file.dart

Issue 9416096: Implement File.directory() and File.directorySync() to get (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove bogus assert Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 * file cannot be deleted. 61 * file cannot be deleted.
62 */ 62 */
63 void delete(); 63 void delete();
64 64
65 /** 65 /**
66 * Synchronously delete the file. 66 * Synchronously delete the file.
67 */ 67 */
68 void deleteSync(); 68 void deleteSync();
69 69
70 /** 70 /**
71 * Get a Directory object for the directory containing this file. If
72 * the file does not exist the [errorHandler] is called. When the
73 * operation completes the [directoryHandler] is called with the
74 * result.
75 */
76 void directory();
77
78 /**
79 * Synchronously get a Directory object for the directory containing
80 * this file.
81 */
82 Directory directorySync();
83
84 /**
71 * Open the file for random access operations. When the file is 85 * Open the file for random access operations. When the file is
72 * opened the [openHandler] is called with the resulting 86 * opened the [openHandler] is called with the resulting
73 * RandomAccessFile. RandomAccessFiles must be closed using the 87 * RandomAccessFile. RandomAccessFiles must be closed using the
74 * [close] method. If the file cannot be opened the [errorHandler] 88 * [close] method. If the file cannot be opened the [errorHandler]
75 * is called. 89 * is called.
76 * 90 *
77 * Files can be opened in three modes: 91 * Files can be opened in three modes:
78 * 92 *
79 * FileMode.READ: open the file for reading. If the file does not 93 * FileMode.READ: open the file for reading. If the file does not
80 * exist the [errorHandler] is called. 94 * exist the [errorHandler] is called.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 */ 192 */
179 void set createHandler(void handler()); 193 void set createHandler(void handler());
180 194
181 /** 195 /**
182 * Sets the handler that gets called when a [delete] operation 196 * Sets the handler that gets called when a [delete] operation
183 * completes. 197 * completes.
184 */ 198 */
185 void set deleteHandler(void handler()); 199 void set deleteHandler(void handler());
186 200
187 /** 201 /**
202 * Sets the handler that gets called when a [directory] operation
203 * completes.
204 */
205 void set directoryHandler(void handler(Directory directory));
206
207 /**
188 * Sets the handler that gets called when an [open] operation 208 * Sets the handler that gets called when an [open] operation
189 * completes. 209 * completes.
190 */ 210 */
191 void set openHandler(void handler(RandomAccessFile openedFile)); 211 void set openHandler(void handler(RandomAccessFile openedFile));
192 212
193 /** 213 /**
194 * Sets the handler that gets called when an [openInputStream] 214 * Sets the handler that gets called when an [openInputStream]
195 * operation completes. 215 * operation completes.
196 */ 216 */
197 void set inputStreamHandler(void handler(InputStream stream)); 217 void set inputStreamHandler(void handler(InputStream stream));
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 */ 438 */
419 void set errorHandler(void handler(String error)); 439 void set errorHandler(void handler(String error));
420 } 440 }
421 441
422 442
423 class FileIOException implements Exception { 443 class FileIOException implements Exception {
424 const FileIOException([String this.message = ""]); 444 const FileIOException([String this.message = ""]);
425 String toString() => "FileIOException: $message"; 445 String toString() => "FileIOException: $message";
426 final String message; 446 final String message;
427 } 447 }
OLDNEW
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/bin/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698