| 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 _file = new File(name); | 7 _file = new File(name); |
| 8 _data = []; | 8 _data = []; |
| 9 _position = 0; | 9 _position = 0; |
| 10 _file.onError = (e) { | 10 _file.onError = (e) { |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 "Mixed use of synchronous and asynchronous API"); | 648 "Mixed use of synchronous and asynchronous API"); |
| 649 } | 649 } |
| 650 var decoder = _StringDecoders.decoder(encoding); | 650 var decoder = _StringDecoders.decoder(encoding); |
| 651 List<int> bytes = readAsBytesSync(); | 651 List<int> bytes = readAsBytesSync(); |
| 652 decoder.write(bytes); | 652 decoder.write(bytes); |
| 653 return _getDecodedLines(decoder); | 653 return _getDecodedLines(decoder); |
| 654 } | 654 } |
| 655 | 655 |
| 656 String get name() => _name; | 656 String get name() => _name; |
| 657 | 657 |
| 658 void set onError(void handler(String error)) { | 658 void set onError(void handler(Exception error)) { |
| 659 _onError = handler; | 659 _onError = handler; |
| 660 } | 660 } |
| 661 | 661 |
| 662 void _ensureFileService() { | 662 void _ensureFileService() { |
| 663 if (_fileService == null) { | 663 if (_fileService == null) { |
| 664 _fileService = _FileUtils.newServicePort(); | 664 _fileService = _FileUtils.newServicePort(); |
| 665 } | 665 } |
| 666 } | 666 } |
| 667 | 667 |
| 668 bool _isErrorResponse(response) { | 668 bool _isErrorResponse(response) { |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 bool _asyncUsed; | 1098 bool _asyncUsed; |
| 1099 int _pendingWrites = 0; | 1099 int _pendingWrites = 0; |
| 1100 | 1100 |
| 1101 SendPort _fileService; | 1101 SendPort _fileService; |
| 1102 | 1102 |
| 1103 Timer _noPendingWriteTimer; | 1103 Timer _noPendingWriteTimer; |
| 1104 | 1104 |
| 1105 Function _onNoPendingWrites; | 1105 Function _onNoPendingWrites; |
| 1106 Function _onError; | 1106 Function _onError; |
| 1107 } | 1107 } |
| OLD | NEW |