Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 16156009: dart:io | Add .stat() and .statSync() to FileSystemEntity and subclasses File, Directory, and Link. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/io/file.dart ('k') | sdk/lib/io/file_system_entity.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698