| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 onDone: () { | 205 onDone: () { |
| 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<RandomAccessFile> close() => |
| 216 _openFuture.then((openedFile) => openedFile.close()); | 216 _openFuture.then((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) { |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 void _checkAvailable() { | 1016 void _checkAvailable() { |
| 1017 if (_asyncDispatched) { | 1017 if (_asyncDispatched) { |
| 1018 throw new FileSystemException("An async operation is currently pending", | 1018 throw new FileSystemException("An async operation is currently pending", |
| 1019 path); | 1019 path); |
| 1020 } | 1020 } |
| 1021 if (closed) { | 1021 if (closed) { |
| 1022 throw new FileSystemException("File closed", path); | 1022 throw new FileSystemException("File closed", path); |
| 1023 } | 1023 } |
| 1024 } | 1024 } |
| 1025 } | 1025 } |
| OLD | NEW |