OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 implements FileInputStream { | 5 class _FileInputStream implements FileInputStream { |
6 _FileInputStream(File file) { | 6 _FileInputStream(File file) { |
7 _file = new File(file.name); | 7 _file = new File(file.name); |
8 _file.openSync(); | 8 _file.openSync(); |
9 } | 9 } |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 if (bytesRead < bytesToRead) { | 25 if (bytesRead < bytesToRead) { |
26 List<int> newBuffer = new List<int>(bytesRead); | 26 List<int> newBuffer = new List<int>(bytesRead); |
27 newBuffer.copyFrom(buffer, 0, 0, bytesRead); | 27 newBuffer.copyFrom(buffer, 0, 0, bytesRead); |
28 return newBuffer; | 28 return newBuffer; |
29 } else { | 29 } else { |
30 return buffer; | 30 return buffer; |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 int readInto(List<int> buffer, int offset, int len) { | 34 int readInto(List<int> buffer, int offset, int len) { |
35 if (offset == null) offset = 0; | 35 if (offset === null) offset = 0; |
36 if (len == null) len = buffer.length; | 36 if (len === null) len = buffer.length; |
37 if (offset < 0) throw new StreamException("Illegal offset $offset"); | 37 if (offset < 0) throw new StreamException("Illegal offset $offset"); |
38 if (len < 0) throw new StreamException("Illegal length $len"); | 38 if (len < 0) throw new StreamException("Illegal length $len"); |
39 return _file.readListSync(buffer, offset, len); | 39 return _file.readListSync(buffer, offset, len); |
40 } | 40 } |
41 | 41 |
42 int available() { | 42 int available() { |
43 return _file.lengthSync() - _file.positionSync(); | 43 return _file.lengthSync() - _file.positionSync(); |
44 } | 44 } |
45 | 45 |
46 bool closed() { | 46 bool closed() { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 321 |
322 var _existsHandler; | 322 var _existsHandler; |
323 var _createHandler; | 323 var _createHandler; |
324 var _openHandler; | 324 var _openHandler; |
325 var _closeHandler; | 325 var _closeHandler; |
326 var _readByteHandler; | 326 var _readByteHandler; |
327 var _readListHandler; | 327 var _readListHandler; |
328 var _noPendingWriteHandler; | 328 var _noPendingWriteHandler; |
329 var _errorHandler; | 329 var _errorHandler; |
330 } | 330 } |
OLD | NEW |