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 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 | 260 |
261 external static _exists(String path); | 261 external static _exists(String path); |
262 | 262 |
263 bool existsSync() { | 263 bool existsSync() { |
264 var result = _exists(_path); | 264 var result = _exists(_path); |
265 throwIfError(result, "Cannot check existence of file '$_path'"); | 265 throwIfError(result, "Cannot check existence of file '$_path'"); |
266 return result; | 266 return result; |
267 } | 267 } |
268 | 268 |
| 269 Future<FileStat> stat() => FileStat.stat(path); |
| 270 |
| 271 FileStat statSync() => FileStat.statSync(path); |
| 272 |
269 Future<File> create() { | 273 Future<File> create() { |
270 _ensureFileService(); | 274 _ensureFileService(); |
271 List request = new List(2); | 275 List request = new List(2); |
272 request[0] = _CREATE_REQUEST; | 276 request[0] = _CREATE_REQUEST; |
273 request[1] = _path; | 277 request[1] = _path; |
274 return _fileService.call(request).then((response) { | 278 return _fileService.call(request).then((response) { |
275 if (_isErrorResponse(response)) { | 279 if (_isErrorResponse(response)) { |
276 throw _exceptionFromResponse(response, "Cannot create file '$_path'"); | 280 throw _exceptionFromResponse(response, "Cannot create file '$_path'"); |
277 } | 281 } |
278 return this; | 282 return this; |
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 | 981 |
978 Future _closedException() { | 982 Future _closedException() { |
979 return new Future.error(new FileIOException("File closed '$_path'")); | 983 return new Future.error(new FileIOException("File closed '$_path'")); |
980 } | 984 } |
981 | 985 |
982 final String _path; | 986 final String _path; |
983 int _id; | 987 int _id; |
984 | 988 |
985 SendPort _fileService; | 989 SendPort _fileService; |
986 } | 990 } |
OLD | NEW |