OLD | NEW |
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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // function. | 350 // function. |
351 class _FileUtils { | 351 class _FileUtils { |
352 external static SendPort _newServicePort(); | 352 external static SendPort _newServicePort(); |
353 } | 353 } |
354 | 354 |
355 // Class for encapsulating the native implementation of files. | 355 // Class for encapsulating the native implementation of files. |
356 class _File extends _FileBase implements File { | 356 class _File extends _FileBase implements File { |
357 // Constructor for file. | 357 // Constructor for file. |
358 _File(String this._name) { | 358 _File(String this._name) { |
359 if (_name is! String) { | 359 if (_name is! String) { |
360 throw new ArgumentError('${NoSuchMethodError.safeToString(_name)} ' | 360 throw new ArgumentError('${Error.safeToString(_name)} ' |
361 'is not a String'); | 361 'is not a String'); |
362 } | 362 } |
363 } | 363 } |
364 | 364 |
365 // Constructor from Path for file. | 365 // Constructor from Path for file. |
366 _File.fromPath(Path path) : this(path.toNativePath()); | 366 _File.fromPath(Path path) : this(path.toNativePath()); |
367 | 367 |
368 Future<bool> exists() { | 368 Future<bool> exists() { |
369 _ensureFileService(); | 369 _ensureFileService(); |
370 List request = new List(2); | 370 List request = new List(2); |
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 new FileIOException("File closed '$_name'")); | 1080 new FileIOException("File closed '$_name'")); |
1081 }); | 1081 }); |
1082 return completer.future; | 1082 return completer.future; |
1083 } | 1083 } |
1084 | 1084 |
1085 final String _name; | 1085 final String _name; |
1086 int _id; | 1086 int _id; |
1087 | 1087 |
1088 SendPort _fileService; | 1088 SendPort _fileService; |
1089 } | 1089 } |
OLD | NEW |