| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 _ensureFileService(); | 612 _ensureFileService(); |
| 613 List request = new List(2); | 613 List request = new List(2); |
| 614 request[0] = _FileUtils.LAST_MODIFIED_REQUEST; | 614 request[0] = _FileUtils.LAST_MODIFIED_REQUEST; |
| 615 request[1] = _name; | 615 request[1] = _name; |
| 616 return _fileService.call(request).transform((response) { | 616 return _fileService.call(request).transform((response) { |
| 617 if (_isErrorResponse(response)) { | 617 if (_isErrorResponse(response)) { |
| 618 throw _exceptionFromResponse(response, | 618 throw _exceptionFromResponse(response, |
| 619 "Cannot retrieve modification time " | 619 "Cannot retrieve modification time " |
| 620 "for file '$_name'"); | 620 "for file '$_name'"); |
| 621 } | 621 } |
| 622 return new Date.fromEpoch(response); | 622 return new Date.fromMillisecondsSinceEpoch(response); |
| 623 }); | 623 }); |
| 624 } | 624 } |
| 625 | 625 |
| 626 Date lastModifiedSync() { | 626 Date lastModifiedSync() { |
| 627 return new Date.fromEpoch(_FileUtils.checkedLastModified(_name)); | 627 int ms = _FileUtils.checkedLastModified(_name); |
| 628 return new Date.fromMillisecondsSinceEpoch(ms); |
| 628 } | 629 } |
| 629 | 630 |
| 630 RandomAccessFile openSync([FileMode mode = FileMode.READ]) { | 631 RandomAccessFile openSync([FileMode mode = FileMode.READ]) { |
| 631 if (mode != FileMode.READ && | 632 if (mode != FileMode.READ && |
| 632 mode != FileMode.WRITE && | 633 mode != FileMode.WRITE && |
| 633 mode != FileMode.APPEND) { | 634 mode != FileMode.APPEND) { |
| 634 throw new FileIOException("Unknown file mode. Use FileMode.READ, " | 635 throw new FileIOException("Unknown file mode. Use FileMode.READ, " |
| 635 "FileMode.WRITE or FileMode.APPEND."); | 636 "FileMode.WRITE or FileMode.APPEND."); |
| 636 } | 637 } |
| 637 var id = _FileUtils.checkedOpen(_name, mode._mode); | 638 var id = _FileUtils.checkedOpen(_name, mode._mode); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 new FileIOException("File closed '$_name'")); | 1155 new FileIOException("File closed '$_name'")); |
| 1155 }); | 1156 }); |
| 1156 return completer.future; | 1157 return completer.future; |
| 1157 } | 1158 } |
| 1158 | 1159 |
| 1159 final String _name; | 1160 final String _name; |
| 1160 int _id; | 1161 int _id; |
| 1161 | 1162 |
| 1162 SendPort _fileService; | 1163 SendPort _fileService; |
| 1163 } | 1164 } |
| OLD | NEW |