| 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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // Constructor from Path for file. | 221 // Constructor from Path for file. |
| 222 _File.fromPath(Path path) : this(path.toNativePath()); | 222 _File.fromPath(Path path) : this(path.toNativePath()); |
| 223 | 223 |
| 224 Future<bool> exists() { | 224 Future<bool> exists() { |
| 225 _ensureFileService(); | 225 _ensureFileService(); |
| 226 List request = new List(2); | 226 List request = new List(2); |
| 227 request[0] = _EXISTS_REQUEST; | 227 request[0] = _EXISTS_REQUEST; |
| 228 request[1] = _path; | 228 request[1] = _path; |
| 229 return _fileService.call(request).then((response) { | 229 return _fileService.call(request).then((response) { |
| 230 if (_isErrorResponse(response)) { | 230 if (_isErrorResponse(response)) { |
| 231 throw _exceptionFromResponse(response, "Cannot open file '$_path'"); | 231 throw _exceptionFromResponse(response, |
| 232 "Cannot check existence of file '$_path'"); |
| 232 } | 233 } |
| 233 return response; | 234 return response; |
| 234 }); | 235 }); |
| 235 } | 236 } |
| 236 | 237 |
| 237 external static _exists(String path); | 238 external static _exists(String path); |
| 238 | 239 |
| 239 bool existsSync() { | 240 bool existsSync() { |
| 240 var result = _exists(_path); | 241 var result = _exists(_path); |
| 241 throwIfError(result, "Cannot check existence of file '$_path'"); | 242 throwIfError(result, "Cannot check existence of file '$_path'"); |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 new FileIOException("File closed '$_path'")); | 1010 new FileIOException("File closed '$_path'")); |
| 1010 }); | 1011 }); |
| 1011 return completer.future; | 1012 return completer.future; |
| 1012 } | 1013 } |
| 1013 | 1014 |
| 1014 final String _path; | 1015 final String _path; |
| 1015 int _id; | 1016 int _id; |
| 1016 | 1017 |
| 1017 SendPort _fileService; | 1018 SendPort _fileService; |
| 1018 } | 1019 } |
| OLD | NEW |