| 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 var file = new File(name); | 7 var file = new File(name); |
| 8 _data = []; | 8 _data = []; |
| 9 _position = 0; | 9 _position = 0; |
| 10 var chained = file.open(FileMode.READ).chain((openedFile) { | 10 var chained = file.open(FileMode.READ).chain((openedFile) { |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 724 if (result != -1) { | 724 if (result != -1) { |
| 725 _id = result; | 725 _id = result; |
| 726 return this; | 726 return this; |
| 727 } else { | 727 } else { |
| 728 throw new FileIOException("Cannot close file '$_name'"); | 728 throw new FileIOException("Cannot close file '$_name'"); |
| 729 } | 729 } |
| 730 }); | 730 }); |
| 731 } | 731 } |
| 732 | 732 |
| 733 void closeSync() { | 733 void closeSync() { |
| 734 _checkNotClosed(); |
| 734 var id = _FileUtils.close(_id); | 735 var id = _FileUtils.close(_id); |
| 735 if (id == -1) { | 736 if (id == -1) { |
| 736 throw new FileIOException("Cannot close file '$_name'"); | 737 throw new FileIOException("Cannot close file '$_name'"); |
| 737 } | 738 } |
| 738 _id = id; | 739 _id = id; |
| 739 } | 740 } |
| 740 | 741 |
| 741 Future<int> readByte() { | 742 Future<int> readByte() { |
| 742 _ensureFileService(); | 743 _ensureFileService(); |
| 743 Completer<int> completer = new Completer<int>(); | 744 Completer<int> completer = new Completer<int>(); |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1090 new FileIOException("File closed '$_name'")); | 1091 new FileIOException("File closed '$_name'")); |
| 1091 }); | 1092 }); |
| 1092 return completer.future; | 1093 return completer.future; |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1095 final String _name; | 1096 final String _name; |
| 1096 int _id; | 1097 int _id; |
| 1097 | 1098 |
| 1098 SendPort _fileService; | 1099 SendPort _fileService; |
| 1099 } | 1100 } |
| OLD | NEW |