OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * FileMode describes the modes in which a file can be opened. | 8 * FileMode describes the modes in which a file can be opened. |
9 */ | 9 */ |
10 class FileMode { | 10 class FileMode { |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 */ | 554 */ |
555 String toString(); | 555 String toString(); |
556 | 556 |
557 /** | 557 /** |
558 * Gets the path of the file underlying this RandomAccessFile. | 558 * Gets the path of the file underlying this RandomAccessFile. |
559 */ | 559 */ |
560 String get path; | 560 String get path; |
561 } | 561 } |
562 | 562 |
563 | 563 |
| 564 /** |
| 565 * Exception thrown when a file operation fails. |
| 566 */ |
564 class FileSystemException implements IOException { | 567 class FileSystemException implements IOException { |
| 568 /** |
| 569 * Message describing the error. This does not include any detailed |
| 570 * information form the underlying OS error. Check [osError] for |
| 571 * that information. |
| 572 */ |
565 final String message; | 573 final String message; |
| 574 |
| 575 /** |
| 576 * The file system path on which the error occurred. Can be `null` |
| 577 * if the exception does not relate directly to a file system path. |
| 578 */ |
566 final String path; | 579 final String path; |
| 580 |
| 581 /** |
| 582 * The underlying OS error. Can be `null` if the exception is not |
| 583 * raised due to an OS error. |
| 584 */ |
567 final OSError osError; | 585 final OSError osError; |
| 586 |
| 587 /** |
| 588 * Creates a new FileSystemException with an optional error message |
| 589 * [message], optional file system path [path] and optional OS error |
| 590 * [osError]. |
| 591 */ |
568 const FileSystemException([this.message = "", this.path = "", this.osError]); | 592 const FileSystemException([this.message = "", this.path = "", this.osError]); |
569 | 593 |
570 String toString() { | 594 String toString() { |
571 StringBuffer sb = new StringBuffer(); | 595 StringBuffer sb = new StringBuffer(); |
572 sb.write("FileSystemException"); | 596 sb.write("FileSystemException"); |
573 if (!message.isEmpty) { | 597 if (!message.isEmpty) { |
574 sb.write(": $message"); | 598 sb.write(": $message"); |
575 if (path != null) { | 599 if (path != null) { |
576 sb.write(", path = $path"); | 600 sb.write(", path = '$path'"); |
577 } | 601 } |
578 if (osError != null) { | 602 if (osError != null) { |
579 sb.write(" ($osError)"); | 603 sb.write(" ($osError)"); |
580 } | 604 } |
581 } else if (osError != null) { | 605 } else if (osError != null) { |
582 sb.write(": osError"); | 606 sb.write(": $osError"); |
583 if (path != null) { | 607 if (path != null) { |
584 sb.write(", path = $path"); | 608 sb.write(", path = '$path'"); |
585 } | 609 } |
| 610 } else if (path != null) { |
| 611 sb.write(": $path"); |
586 } | 612 } |
587 return sb.toString(); | 613 return sb.toString(); |
588 } | 614 } |
589 } | 615 } |
OLD | NEW |