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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1041 new FileIOException("File closed '$_path'")); | 1043 new FileIOException("File closed '$_path'")); |
1042 }); | 1044 }); |
1043 return completer.future; | 1045 return completer.future; |
1044 } | 1046 } |
1045 | 1047 |
1046 final String _path; | 1048 final String _path; |
1047 int _id; | 1049 int _id; |
1048 | 1050 |
1049 SendPort _fileService; | 1051 SendPort _fileService; |
1050 } | 1052 } |
OLD | NEW |