| 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 class _BaseDataInputStream { |
| 6 abstract int available(); | 6 abstract 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(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 void pipe(OutputStream output, [bool close = true]) { | 34 void pipe(OutputStream output, [bool close = true]) { |
| 35 _pipe(this, output, close: close); | 35 _pipe(this, output, close: close); |
| 36 } | 36 } |
| 37 | 37 |
| 38 void close() { | 38 void close() { |
| 39 _cancelScheduledDataCallback(); | 39 _cancelScheduledDataCallback(); |
| 40 _close(); | 40 _close(); |
| 41 _checkScheduleCallbacks(); | 41 _checkScheduleCallbacks(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool get closed() => _closeCallbackCalled; | 44 bool get closed => _closeCallbackCalled; |
| 45 | 45 |
| 46 void set onData(void callback()) { | 46 void set onData(void callback()) { |
| 47 _clientDataHandler = callback; | 47 _clientDataHandler = callback; |
| 48 _checkScheduleCallbacks(); | 48 _checkScheduleCallbacks(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void set onClosed(void callback()) { | 51 void set onClosed(void callback()) { |
| 52 _clientCloseHandler = callback; | 52 _clientCloseHandler = callback; |
| 53 _checkScheduleCallbacks(); | 53 _checkScheduleCallbacks(); |
| 54 } | 54 } |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void _reportError(e) { | 202 void _reportError(e) { |
| 203 if (_onError != null) { | 203 if (_onError != null) { |
| 204 _onError(e); | 204 _onError(e); |
| 205 } else { | 205 } else { |
| 206 throw e; | 206 throw e; |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 Function _onError; | 210 Function _onError; |
| 211 } | 211 } |
| OLD | NEW |