| 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 } | 490 } |
| 491 | 491 |
| 492 RandomAccessFile openSync([FileMode mode = FileMode.READ]) { | 492 RandomAccessFile openSync([FileMode mode = FileMode.READ]) { |
| 493 if (_asyncUsed) { | 493 if (_asyncUsed) { |
| 494 throw new FileIOException( | 494 throw new FileIOException( |
| 495 "Mixed use of synchronous and asynchronous API"); | 495 "Mixed use of synchronous and asynchronous API"); |
| 496 } | 496 } |
| 497 if (mode != FileMode.READ && | 497 if (mode != FileMode.READ && |
| 498 mode != FileMode.WRITE && | 498 mode != FileMode.WRITE && |
| 499 mode != FileMode.APPEND) { | 499 mode != FileMode.APPEND) { |
| 500 throw new FileIOException("Unknown file mode. Use FileMode.READ, " + | 500 throw new FileIOException("Unknown file mode. Use FileMode.READ, " |
| 501 "FileMode.WRITE or FileMode.APPEND."); | 501 "FileMode.WRITE or FileMode.APPEND."); |
| 502 } | 502 } |
| 503 var id = _FileUtils.checkedOpen(_name, mode._mode); | 503 var id = _FileUtils.checkedOpen(_name, mode._mode); |
| 504 assert(id != 0); | 504 assert(id != 0); |
| 505 return new _RandomAccessFile(id, _name); | 505 return new _RandomAccessFile(id, _name); |
| 506 } | 506 } |
| 507 | 507 |
| 508 static RandomAccessFile _openStdioSync(int fd) { | 508 static RandomAccessFile _openStdioSync(int fd) { |
| 509 var id = _FileUtils.openStdio(fd); | 509 var id = _FileUtils.openStdio(fd); |
| 510 if (id == 0) { | 510 if (id == 0) { |
| (...skipping 587 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 |