| 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._internal(0); | 10 static final READ = const FileMode._internal(0); |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 | 210 |
| 211 /** | 211 /** |
| 212 * Get the name of the file. | 212 * Get the name of the file. |
| 213 */ | 213 */ |
| 214 String get name(); | 214 String get name(); |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * Sets the handler that gets called when errors occur during | 217 * Sets the handler that gets called when errors occur during |
| 218 * operations on this file. | 218 * operations on this file. |
| 219 */ | 219 */ |
| 220 void set onError(void handler(Exception e)); | 220 void set onError(void handler(e)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 | 223 |
| 224 /** | 224 /** |
| 225 * [RandomAccessFile] provides random access to the data in a | 225 * [RandomAccessFile] provides random access to the data in a |
| 226 * file. [RandomAccessFile] objects are obtained by calling the | 226 * file. [RandomAccessFile] objects are obtained by calling the |
| 227 * [:open:] method on a [File] object. | 227 * [:open:] method on a [File] object. |
| 228 */ | 228 */ |
| 229 interface RandomAccessFile { | 229 interface RandomAccessFile { |
| 230 /** | 230 /** |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 /** | 369 /** |
| 370 * Sets the handler that gets called when there are no more write | 370 * Sets the handler that gets called when there are no more write |
| 371 * operations pending for this file. | 371 * operations pending for this file. |
| 372 */ | 372 */ |
| 373 void set onNoPendingWrites(void handler()); | 373 void set onNoPendingWrites(void handler()); |
| 374 | 374 |
| 375 /** | 375 /** |
| 376 * Sets the handler that gets called when errors occur when | 376 * Sets the handler that gets called when errors occur when |
| 377 * operating on this file. | 377 * operating on this file. |
| 378 */ | 378 */ |
| 379 void set onError(void handler(Exception e)); | 379 void set onError(void handler(e)); |
| 380 } | 380 } |
| 381 | 381 |
| 382 | 382 |
| 383 class FileIOException implements Exception { | 383 class FileIOException implements Exception { |
| 384 const FileIOException([String this.message = "", | 384 const FileIOException([String this.message = "", |
| 385 OSError this.osError = null]); | 385 OSError this.osError = null]); |
| 386 String toString() { | 386 String toString() { |
| 387 StringBuffer sb = new StringBuffer(); | 387 StringBuffer sb = new StringBuffer(); |
| 388 sb.add("FileIOException"); | 388 sb.add("FileIOException"); |
| 389 if (!message.isEmpty()) { | 389 if (!message.isEmpty()) { |
| 390 sb.add(": $message"); | 390 sb.add(": $message"); |
| 391 if (osError != null) { | 391 if (osError != null) { |
| 392 sb.add(" ($osError)"); | 392 sb.add(" ($osError)"); |
| 393 } | 393 } |
| 394 } else if (osError != null) { | 394 } else if (osError != null) { |
| 395 sb.add(": osError"); | 395 sb.add(": osError"); |
| 396 } | 396 } |
| 397 return sb.toString(); | 397 return sb.toString(); |
| 398 } | 398 } |
| 399 final String message; | 399 final String message; |
| 400 final OSError osError; | 400 final OSError osError; |
| 401 } | 401 } |
| OLD | NEW |