| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 } | 242 } |
| 243 } | 243 } |
| 244 | 244 |
| 245 void set onClosed(void callback()) { | 245 void set onClosed(void callback()) { |
| 246 _onClosed = callback; | 246 _onClosed = callback; |
| 247 } | 247 } |
| 248 | 248 |
| 249 void _processPendingOperations() { | 249 void _processPendingOperations() { |
| 250 _pendingOperations.forEach((buffer) { | 250 _pendingOperations.forEach((buffer) { |
| 251 if (buffer is _PendingOperation) { | 251 if (buffer is _PendingOperation) { |
| 252 if (buffer === _PendingOperation.CLOSE) { | 252 if (identical(buffer, _PendingOperation.CLOSE)) { |
| 253 close(); | 253 close(); |
| 254 } else { | 254 } else { |
| 255 assert(buffer === _PendingOperation.FLUSH); | 255 assert(identical(buffer, _PendingOperation.FLUSH)); |
| 256 flush(); | 256 flush(); |
| 257 } | 257 } |
| 258 } else { | 258 } else { |
| 259 write(buffer); | 259 write(buffer); |
| 260 } | 260 } |
| 261 }); | 261 }); |
| 262 _pendingOperations = null; | 262 _pendingOperations = null; |
| 263 } | 263 } |
| 264 | 264 |
| 265 void _write(List<int> buffer, int offset, int len) { | 265 void _write(List<int> buffer, int offset, int len) { |
| (...skipping 814 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 |