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 // Read the file in blocks of size 64k. | 7 // Read the file in blocks of size 64k. |
8 const int _BLOCK_SIZE = 64 * 1024; | 8 const int _BLOCK_SIZE = 64 * 1024; |
9 | 9 |
10 | 10 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 _closeFile(); | 119 _closeFile(); |
120 _unsubscribed = true; | 120 _unsubscribed = true; |
121 } | 121 } |
122 }); | 122 }); |
123 } | 123 } |
124 | 124 |
125 void _start() { | 125 void _start() { |
126 if (_position < 0) { | 126 if (_position < 0) { |
127 _controller.addError(new RangeError("Bad start position: $_position")); | 127 _controller.addError(new RangeError("Bad start position: $_position")); |
128 _controller.close(); | 128 _controller.close(); |
| 129 _closeCompleter.complete(); |
129 return; | 130 return; |
130 } | 131 } |
131 | 132 |
132 void onReady(RandomAccessFile file) { | 133 void onReady(RandomAccessFile file) { |
133 _openedFile = file; | 134 _openedFile = file; |
134 _readInProgress = false; | 135 _readInProgress = false; |
135 _readBlock(); | 136 _readBlock(); |
136 } | 137 } |
137 | 138 |
138 void onOpenFile(RandomAccessFile file) { | 139 void onOpenFile(RandomAccessFile file) { |
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 void _checkAvailable() { | 922 void _checkAvailable() { |
922 if (_asyncDispatched) { | 923 if (_asyncDispatched) { |
923 throw new FileSystemException("An async operation is currently pending", | 924 throw new FileSystemException("An async operation is currently pending", |
924 path); | 925 path); |
925 } | 926 } |
926 if (closed) { | 927 if (closed) { |
927 throw new FileSystemException("File closed", path); | 928 throw new FileSystemException("File closed", path); |
928 } | 929 } |
929 } | 930 } |
930 } | 931 } |
OLD | NEW |