| 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 * The modes in which a File can be opened. | 8 * The modes in which a File can be opened. |
| 9 */ | 9 */ |
| 10 class FileMode { | 10 class FileMode { |
| (...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 * the process. Note that this does not actually lock the file for | 744 * the process. Note that this does not actually lock the file for |
| 745 * access. Also note that advisory locks are on a process | 745 * access. Also note that advisory locks are on a process |
| 746 * level. This means that several isolates in the same process can | 746 * level. This means that several isolates in the same process can |
| 747 * obtain an exclusive lock on the same file. | 747 * obtain an exclusive lock on the same file. |
| 748 * | 748 * |
| 749 * On Windows the regions used for lock and unlock needs to match. If that | 749 * On Windows the regions used for lock and unlock needs to match. If that |
| 750 * is not the case unlocking will result in the OS error "The segment is | 750 * is not the case unlocking will result in the OS error "The segment is |
| 751 * already unlocked". | 751 * already unlocked". |
| 752 */ | 752 */ |
| 753 Future<RandomAccessFile> lock( | 753 Future<RandomAccessFile> lock( |
| 754 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end]); | 754 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]); |
| 755 | 755 |
| 756 /** | 756 /** |
| 757 * Synchronously locks the file or part of the file. | 757 * Synchronously locks the file or part of the file. |
| 758 * | 758 * |
| 759 * By default an exclusive lock will be obtained, but that can be overridden | 759 * By default an exclusive lock will be obtained, but that can be overridden |
| 760 * by the [mode] argument. | 760 * by the [mode] argument. |
| 761 * | 761 * |
| 762 * Locks the byte range from [start] to [end] of the file ,with the | 762 * Locks the byte range from [start] to [end] of the file ,with the |
| 763 * byte at position `end` not included. If no arguments are | 763 * byte at position `end` not included. If no arguments are |
| 764 * specified, the full file is locked, If only `start` is specified | 764 * specified, the full file is locked, If only `start` is specified |
| (...skipping 12 matching lines...) Expand all Loading... |
| 777 * the process. Note that this does not actually lock the file for | 777 * the process. Note that this does not actually lock the file for |
| 778 * access. Also note that advisory locks are on a process | 778 * access. Also note that advisory locks are on a process |
| 779 * level. This means that several isolates in the same process can | 779 * level. This means that several isolates in the same process can |
| 780 * obtain an exclusive lock on the same file. | 780 * obtain an exclusive lock on the same file. |
| 781 * | 781 * |
| 782 * On Windows the regions used for lock and unlock needs to match. If that | 782 * On Windows the regions used for lock and unlock needs to match. If that |
| 783 * is not the case unlocking will result in the OS error "The segment is | 783 * is not the case unlocking will result in the OS error "The segment is |
| 784 * already unlocked". | 784 * already unlocked". |
| 785 * | 785 * |
| 786 */ | 786 */ |
| 787 void lockSync([FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end]); | 787 void lockSync( |
| 788 [FileLock mode = FileLock.EXCLUSIVE, int start = 0, int end = -1]); |
| 788 | 789 |
| 789 /** | 790 /** |
| 790 * Unlocks the file or part of the file. | 791 * Unlocks the file or part of the file. |
| 791 * | 792 * |
| 792 * Unlocks the byte range from [start] to [end] of the file, with | 793 * Unlocks the byte range from [start] to [end] of the file, with |
| 793 * the byte at position `end` not included. If no arguments are | 794 * the byte at position `end` not included. If no arguments are |
| 794 * specified, the full file is unlocked, If only `start` is | 795 * specified, the full file is unlocked, If only `start` is |
| 795 * specified the file is unlocked from byte position `start` to the | 796 * specified the file is unlocked from byte position `start` to the |
| 796 * end of the file. | 797 * end of the file. |
| 797 * | 798 * |
| 798 * *NOTE* file locking does have slight differences in behavior across | 799 * *NOTE* file locking does have slight differences in behavior across |
| 799 * platforms: | 800 * platforms: |
| 800 * | 801 * |
| 801 * See [lock] for more details. | 802 * See [lock] for more details. |
| 802 */ | 803 */ |
| 803 Future<RandomAccessFile> unlock([int start = 0, int end]); | 804 Future<RandomAccessFile> unlock([int start = 0, int end = -1]); |
| 804 | 805 |
| 805 /** | 806 /** |
| 806 * Synchronously unlocks the file or part of the file. | 807 * Synchronously unlocks the file or part of the file. |
| 807 * | 808 * |
| 808 * Unlocks the byte range from [start] to [end] of the file, with | 809 * Unlocks the byte range from [start] to [end] of the file, with |
| 809 * the byte at position `end` not included. If no arguments are | 810 * the byte at position `end` not included. If no arguments are |
| 810 * specified, the full file is unlocked, If only `start` is | 811 * specified, the full file is unlocked, If only `start` is |
| 811 * specified the file is unlocked from byte position `start` to the | 812 * specified the file is unlocked from byte position `start` to the |
| 812 * end of the file. | 813 * end of the file. |
| 813 * | 814 * |
| 814 * *NOTE* file locking does have slight differences in behavior across | 815 * *NOTE* file locking does have slight differences in behavior across |
| 815 * platforms: | 816 * platforms: |
| 816 * | 817 * |
| 817 * See [lockSync] for more details. | 818 * See [lockSync] for more details. |
| 818 */ | 819 */ |
| 819 void unlockSync([int start = 0, int end]); | 820 void unlockSync([int start = 0, int end = -1]); |
| 820 | 821 |
| 821 /** | 822 /** |
| 822 * Returns a human-readable string for this RandomAccessFile instance. | 823 * Returns a human-readable string for this RandomAccessFile instance. |
| 823 */ | 824 */ |
| 824 String toString(); | 825 String toString(); |
| 825 | 826 |
| 826 /** | 827 /** |
| 827 * Gets the path of the file underlying this RandomAccessFile. | 828 * Gets the path of the file underlying this RandomAccessFile. |
| 828 */ | 829 */ |
| 829 String get path; | 830 String get path; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 sb.write(": $osError"); | 876 sb.write(": $osError"); |
| 876 if (path != null) { | 877 if (path != null) { |
| 877 sb.write(", path = '$path'"); | 878 sb.write(", path = '$path'"); |
| 878 } | 879 } |
| 879 } else if (path != null) { | 880 } else if (path != null) { |
| 880 sb.write(": $path"); | 881 sb.write(": $path"); |
| 881 } | 882 } |
| 882 return sb.toString(); | 883 return sb.toString(); |
| 883 } | 884 } |
| 884 } | 885 } |
| OLD | NEW |