| 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 _BaseDataInputStream { | 5 abstract class _BaseDataInputStream { |
| 6 abstract int available(); | 6 int available(); |
| 7 | 7 |
| 8 List<int> read([int len]) { | 8 List<int> read([int len]) { |
| 9 if (_closeCallbackCalled || _scheduledCloseCallback != null) return null; | 9 if (_closeCallbackCalled || _scheduledCloseCallback != null) return null; |
| 10 int bytesToRead = available(); | 10 int bytesToRead = available(); |
| 11 if (bytesToRead == 0) { | 11 if (bytesToRead == 0) { |
| 12 _checkScheduleCallbacks(); | 12 _checkScheduleCallbacks(); |
| 13 return null; | 13 return null; |
| 14 } | 14 } |
| 15 if (len !== null) { | 15 if (len !== null) { |
| 16 if (len <= 0) { | 16 if (len <= 0) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 void _reportError(e) { | 60 void _reportError(e) { |
| 61 if (_clientErrorHandler != null) { | 61 if (_clientErrorHandler != null) { |
| 62 _clientErrorHandler(e); | 62 _clientErrorHandler(e); |
| 63 } else { | 63 } else { |
| 64 throw e; | 64 throw e; |
| 65 } | 65 } |
| 66 } | 66 } |
| 67 | 67 |
| 68 abstract List<int> _read(int bytesToRead); | 68 List<int> _read(int bytesToRead); |
| 69 | 69 |
| 70 void _dataReceived() { | 70 void _dataReceived() { |
| 71 // More data has been received asynchronously. Perform the data | 71 // More data has been received asynchronously. Perform the data |
| 72 // handler callback now. | 72 // handler callback now. |
| 73 _cancelScheduledDataCallback(); | 73 _cancelScheduledDataCallback(); |
| 74 if (_clientDataHandler !== null) { | 74 if (_clientDataHandler !== null) { |
| 75 _clientDataHandler(); | 75 _clientDataHandler(); |
| 76 } | 76 } |
| 77 _checkScheduleCallbacks(); | 77 _checkScheduleCallbacks(); |
| 78 } | 78 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 void _reportError(e) { | 200 void _reportError(e) { |
| 201 if (_onError != null) { | 201 if (_onError != null) { |
| 202 _onError(e); | 202 _onError(e); |
| 203 } else { | 203 } else { |
| 204 throw e; | 204 throw e; |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 Function _onError; | 208 Function _onError; |
| 209 } | 209 } |
| OLD | NEW |