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

Side by Side Diff: dart/runtime/bin/file_impl.dart

Issue 10983066: Minor improvement to File diagnostics (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added a test Created 8 years, 2 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 class _FileInputStream extends _BaseDataInputStream implements InputStream { 5 class _FileInputStream extends _BaseDataInputStream implements InputStream {
6 _FileInputStream(String name) 6 _FileInputStream(String name)
7 : _data = const [], 7 : _data = const [],
8 _position = 0, 8 _position = 0,
9 _filePosition = 0 { 9 _filePosition = 0 {
10 var file = new File(name); 10 var file = new File(name);
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 return new FileIOException("File closed"); 486 return new FileIOException("File closed");
487 default: 487 default:
488 return new Exception("Unknown error"); 488 return new Exception("Unknown error");
489 } 489 }
490 } 490 }
491 } 491 }
492 492
493 // Class for encapsulating the native implementation of files. 493 // Class for encapsulating the native implementation of files.
494 class _File extends _FileBase implements File { 494 class _File extends _FileBase implements File {
495 // Constructor for file. 495 // Constructor for file.
496 _File(String this._name); 496 _File(String this._name) {
497 if (_name is! String) {
498 throw new ArgumentError('${NoSuchMethodError.safeToString(_name)} '
499 'is not a String');
500 }
501 }
497 502
498 // Constructor from Path for file. 503 // Constructor from Path for file.
499 _File.fromPath(Path path) : this(path.toNativePath()); 504 _File.fromPath(Path path) : this(path.toNativePath());
500 505
501 Future<bool> exists() { 506 Future<bool> exists() {
502 _ensureFileService(); 507 _ensureFileService();
503 List request = new List(2); 508 List request = new List(2);
504 request[0] = _FileUtils.EXISTS_REQUEST; 509 request[0] = _FileUtils.EXISTS_REQUEST;
505 request[1] = _name; 510 request[1] = _name;
506 return _fileService.call(request).transform((response) { 511 return _fileService.call(request).transform((response) {
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 new FileIOException("File closed '$_name'")); 1170 new FileIOException("File closed '$_name'"));
1166 }); 1171 });
1167 return completer.future; 1172 return completer.future;
1168 } 1173 }
1169 1174
1170 final String _name; 1175 final String _name;
1171 int _id; 1176 int _id;
1172 1177
1173 SendPort _fileService; 1178 SendPort _fileService;
1174 } 1179 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698