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 class _FileStream extends Stream<List<int>> { | 8 class _FileStream extends Stream<List<int>> { |
9 // Stream controller. | 9 // Stream controller. |
10 StreamController<List<int>> _controller; | 10 StreamController<List<int>> _controller; |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 return _fileService.call(request).then((response) { | 292 return _fileService.call(request).then((response) { |
293 if (_isErrorResponse(response)) { | 293 if (_isErrorResponse(response)) { |
294 throw _exceptionFromResponse(response, "Cannot create file '$_path'"); | 294 throw _exceptionFromResponse(response, "Cannot create file '$_path'"); |
295 } | 295 } |
296 return this; | 296 return this; |
297 }); | 297 }); |
298 } | 298 } |
299 | 299 |
300 external static _create(String path); | 300 external static _create(String path); |
301 | 301 |
| 302 external static _createLink(String path, String target); |
| 303 |
302 void createSync() { | 304 void createSync() { |
303 var result = _create(_path); | 305 var result = _create(_path); |
304 throwIfError(result, "Cannot create file '$_path'"); | 306 throwIfError(result, "Cannot create file '$_path'"); |
305 } | 307 } |
306 | 308 |
307 Future<File> delete() { | 309 Future<File> delete() { |
308 _ensureFileService(); | 310 _ensureFileService(); |
309 List request = new List(2); | 311 List request = new List(2); |
310 request[0] = _DELETE_REQUEST; | 312 request[0] = _DELETE_REQUEST; |
311 request[1] = _path; | 313 request[1] = _path; |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 new FileIOException("File closed '$_path'")); | 1051 new FileIOException("File closed '$_path'")); |
1050 }); | 1052 }); |
1051 return completer.future; | 1053 return completer.future; |
1052 } | 1054 } |
1053 | 1055 |
1054 final String _path; | 1056 final String _path; |
1055 int _id; | 1057 int _id; |
1056 | 1058 |
1057 SendPort _fileService; | 1059 SendPort _fileService; |
1058 } | 1060 } |
OLD | NEW |