| 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(File file) { | 6 _FileInputStream(File file) { |
| 7 _file = file.openSync(); | 7 _file = file.openSync(); |
| 8 _length = _file.lengthSync(); | 8 _length = _file.lengthSync(); |
| 9 _streamMarkedClosed = true; | 9 _streamMarkedClosed = true; |
| 10 _checkScheduleCallbacks(); | 10 _checkScheduleCallbacks(); |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 946 void setPositionSync(int position) { | 946 void setPositionSync(int position) { |
| 947 if (_asyncUsed) { | 947 if (_asyncUsed) { |
| 948 throw new FileIOException( | 948 throw new FileIOException( |
| 949 "Mixed use of synchronous and asynchronous API"); | 949 "Mixed use of synchronous and asynchronous API"); |
| 950 } | 950 } |
| 951 bool result = _FileUtils.setPosition(_id, position); | 951 bool result = _FileUtils.setPosition(_id, position); |
| 952 if (result == false) { | 952 if (result == false) { |
| 953 throw new FileIOException("setPosition failed"); | 953 throw new FileIOException("setPosition failed"); |
| 954 } | 954 } |
| 955 } | 955 } |
| 956 | 956 |
| 957 void truncate(int length) { | 957 void truncate(int length) { |
| 958 _asyncUsed = true; | 958 _asyncUsed = true; |
| 959 var handler = (_truncateHandler != null) ? _truncateHandler : () => null; | 959 var handler = (_truncateHandler != null) ? _truncateHandler : () => null; |
| 960 var handleTruncateResult = (result, ignored) { | 960 var handleTruncateResult = (result, ignored) { |
| 961 if (result == false && _errorHandler != null) { | 961 if (result == false && _errorHandler != null) { |
| 962 _errorHandler("truncate failed"); | 962 _errorHandler("truncate failed"); |
| 963 return; | 963 return; |
| 964 } | 964 } |
| 965 handler(); | 965 handler(); |
| 966 }; | 966 }; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1082 var _readByteHandler; | 1082 var _readByteHandler; |
| 1083 var _readListHandler; | 1083 var _readListHandler; |
| 1084 var _noPendingWriteHandler; | 1084 var _noPendingWriteHandler; |
| 1085 var _positionHandler; | 1085 var _positionHandler; |
| 1086 var _setPositionHandler; | 1086 var _setPositionHandler; |
| 1087 var _truncateHandler; | 1087 var _truncateHandler; |
| 1088 var _lengthHandler; | 1088 var _lengthHandler; |
| 1089 var _flushHandler; | 1089 var _flushHandler; |
| 1090 var _errorHandler; | 1090 var _errorHandler; |
| 1091 } | 1091 } |
| OLD | NEW |