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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 openFailed(e, s); | 165 openFailed(e, s); |
166 } | 166 } |
167 } | 167 } |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 class _FileStreamConsumer extends StreamConsumer<List<int>> { | 171 class _FileStreamConsumer extends StreamConsumer<List<int>> { |
172 File _file; | 172 File _file; |
173 Future<RandomAccessFile> _openFuture; | 173 Future<RandomAccessFile> _openFuture; |
174 | 174 |
175 _FileStreamConsumer(File this._file, FileMode mode) { | 175 _FileStreamConsumer(this._file, FileMode mode) { |
176 _openFuture = _file.open(mode: mode); | 176 _openFuture = _file.open(mode: mode); |
177 } | 177 } |
178 | 178 |
179 _FileStreamConsumer.fromStdio(int fd) { | 179 _FileStreamConsumer.fromStdio(int fd) { |
180 assert(1 <= fd && fd <= 2); | 180 assert(1 <= fd && fd <= 2); |
181 _openFuture = new Future.value(_File._openStdioSync(fd)); | 181 _openFuture = new Future.value(_File._openStdioSync(fd)); |
182 } | 182 } |
183 | 183 |
184 Future<File> addStream(Stream<List<int>> stream) { | 184 Future<File> addStream(Stream<List<int>> stream) { |
185 Completer<File> completer = new Completer<File>.sync(); | 185 Completer<File> completer = new Completer<File>.sync(); |
(...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 void _checkAvailable() { | 1091 void _checkAvailable() { |
1092 if (_asyncDispatched) { | 1092 if (_asyncDispatched) { |
1093 throw new FileSystemException("An async operation is currently pending", | 1093 throw new FileSystemException("An async operation is currently pending", |
1094 path); | 1094 path); |
1095 } | 1095 } |
1096 if (closed) { | 1096 if (closed) { |
1097 throw new FileSystemException("File closed", path); | 1097 throw new FileSystemException("File closed", path); |
1098 } | 1098 } |
1099 } | 1099 } |
1100 } | 1100 } |
OLD | NEW |