| OLD | NEW |
| 1 // Copyright (c) 2011, 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) return null; | 9 if (_closeCallbackCalled) 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) { |
| 17 throw new StreamException("Illegal length $len"); | 17 throw new StreamException("Illegal length $len"); |
| 18 } else if (bytesToRead > len) { | 18 } else if (bytesToRead > len) { |
| 19 bytesToRead = len; | 19 bytesToRead = len; |
| 20 } | 20 } |
| 21 } | 21 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 input.dataHandler = pipeDataHandler; | 133 input.dataHandler = pipeDataHandler; |
| 134 output.noPendingWriteHandler = null; | 134 output.noPendingWriteHandler = null; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 _inputCloseHandler = input._clientCloseHandler; | 137 _inputCloseHandler = input._clientCloseHandler; |
| 138 input.dataHandler = pipeDataHandler; | 138 input.dataHandler = pipeDataHandler; |
| 139 input.closeHandler = pipeCloseHandler; | 139 input.closeHandler = pipeCloseHandler; |
| 140 output.noPendingWriteHandler = null; | 140 output.noPendingWriteHandler = null; |
| 141 } | 141 } |
| 142 | 142 |
| OLD | NEW |