| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 const int _READ_LIST_REQUEST = 16; | 322 const int _READ_LIST_REQUEST = 16; |
| 323 const int _WRITE_LIST_REQUEST = 17; | 323 const int _WRITE_LIST_REQUEST = 17; |
| 324 const int _WRITE_STRING_REQUEST = 18; | 324 const int _WRITE_STRING_REQUEST = 18; |
| 325 | 325 |
| 326 // Base class for _File and _RandomAccessFile with shared functions. | 326 // Base class for _File and _RandomAccessFile with shared functions. |
| 327 class _FileBase { | 327 class _FileBase { |
| 328 bool _isErrorResponse(response) { | 328 bool _isErrorResponse(response) { |
| 329 return response is List && response[0] != _SUCCESS_RESPONSE; | 329 return response is List && response[0] != _SUCCESS_RESPONSE; |
| 330 } | 330 } |
| 331 | 331 |
| 332 Exception _exceptionFromResponse(response, String message) { | 332 _exceptionFromResponse(response, String message) { |
| 333 assert(_isErrorResponse(response)); | 333 assert(_isErrorResponse(response)); |
| 334 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) { | 334 switch (response[_ERROR_RESPONSE_ERROR_TYPE]) { |
| 335 case _ILLEGAL_ARGUMENT_RESPONSE: | 335 case _ILLEGAL_ARGUMENT_RESPONSE: |
| 336 return new ArgumentError(); | 336 return new ArgumentError(); |
| 337 case _OSERROR_RESPONSE: | 337 case _OSERROR_RESPONSE: |
| 338 var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE], | 338 var err = new OSError(response[_OSERROR_RESPONSE_MESSAGE], |
| 339 response[_OSERROR_RESPONSE_ERROR_CODE]); | 339 response[_OSERROR_RESPONSE_ERROR_CODE]); |
| 340 return new FileIOException(message, err); | 340 return new FileIOException(message, err); |
| 341 case _FILE_CLOSED_RESPONSE: | 341 case _FILE_CLOSED_RESPONSE: |
| 342 return new FileIOException("File closed"); | 342 return new FileIOException("File closed"); |
| (...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1086 new FileIOException("File closed '$_name'")); | 1086 new FileIOException("File closed '$_name'")); |
| 1087 }); | 1087 }); |
| 1088 return completer.future; | 1088 return completer.future; |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 final String _name; | 1091 final String _name; |
| 1092 int _id; | 1092 int _id; |
| 1093 | 1093 |
| 1094 SendPort _fileService; | 1094 SendPort _fileService; |
| 1095 } | 1095 } |
| OLD | NEW |