OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 /** | 7 /** |
8 * Helper class to wrap a [StreamConsumer<List<int>, T>] and provide utility | 8 * Helper class to wrap a [StreamConsumer<List<int>, T>] and provide utility |
9 * functions for writing to the StreamConsumer directly. The [IOSink] | 9 * functions for writing to the StreamConsumer directly. The [IOSink] |
10 * buffers the input given by [add] and [addString] and will delay a [consume] | 10 * buffers the input given by [add] and [addString] and will delay a [consume] |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 _bindSubscription = stream.listen( | 171 _bindSubscription = stream.listen( |
172 _controller.add, | 172 _controller.add, |
173 onDone: () { | 173 onDone: () { |
174 if (unbind) { | 174 if (unbind) { |
175 completeUnbind(); | 175 completeUnbind(); |
176 } else { | 176 } else { |
177 _controller.close(); | 177 _controller.close(); |
178 } | 178 } |
179 }, | 179 }, |
180 onError: _controller.signalError); | 180 onError: _controller.addError); |
181 if (_paused) _pause(); | 181 if (_paused) _pause(); |
182 if (unbind) { | 182 if (unbind) { |
183 _pipeFuture | 183 _pipeFuture |
184 .then((_) => completeUnbind(), | 184 .then((_) => completeUnbind(), |
185 onError: (error) => completeUnbind(error)); | 185 onError: (error) => completeUnbind(error)); |
186 return unbindCompleter.future; | 186 return unbindCompleter.future; |
187 } else { | 187 } else { |
188 return _pipeFuture.then((_) => this); | 188 return _pipeFuture.then((_) => this); |
189 } | 189 } |
190 } | 190 } |
191 } | 191 } |
OLD | NEW |