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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 completer.complete(_file); | 206 completer.complete(_file); |
207 }, | 207 }, |
208 onError: error, | 208 onError: error, |
209 cancelOnError: true); | 209 cancelOnError: true); |
210 }) | 210 }) |
211 .catchError(completer.completeError); | 211 .catchError(completer.completeError); |
212 return completer.future; | 212 return completer.future; |
213 } | 213 } |
214 | 214 |
215 Future<File> close() => | 215 Future<File> close() => |
216 _openFuture.then/*<File>*/((openedFile) => openedFile.close()); | 216 _openFuture.then<File>((openedFile) => openedFile.close()); |
217 } | 217 } |
218 | 218 |
219 | 219 |
220 // Class for encapsulating the native implementation of files. | 220 // Class for encapsulating the native implementation of files. |
221 class _File extends FileSystemEntity implements File { | 221 class _File extends FileSystemEntity implements File { |
222 final String path; | 222 final String path; |
223 | 223 |
224 // Constructor for file. | 224 // Constructor for file. |
225 _File(this.path) { | 225 _File(this.path) { |
226 if (path is! String) { | 226 if (path is! String) { |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1028 void _checkAvailable() { | 1028 void _checkAvailable() { |
1029 if (_asyncDispatched) { | 1029 if (_asyncDispatched) { |
1030 throw new FileSystemException("An async operation is currently pending", | 1030 throw new FileSystemException("An async operation is currently pending", |
1031 path); | 1031 path); |
1032 } | 1032 } |
1033 if (closed) { | 1033 if (closed) { |
1034 throw new FileSystemException("File closed", path); | 1034 throw new FileSystemException("File closed", path); |
1035 } | 1035 } |
1036 } | 1036 } |
1037 } | 1037 } |
OLD | NEW |