OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library async.stream_sink_transformer.stream_transformer_wrapper; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import '../stream_sink_transformer.dart'; | 7 import '../stream_sink_transformer.dart'; |
10 | 8 |
11 /// A [StreamSinkTransformer] that wraps a pre-existing [StreamTransformer]. | 9 /// A [StreamSinkTransformer] that wraps a pre-existing [StreamTransformer]. |
12 class StreamTransformerWrapper<S, T> implements StreamSinkTransformer<S, T> { | 10 class StreamTransformerWrapper<S, T> implements StreamSinkTransformer<S, T> { |
13 /// The wrapped transformer. | 11 /// The wrapped transformer. |
14 final StreamTransformer<S, T> _transformer; | 12 final StreamTransformer<S, T> _transformer; |
15 | 13 |
16 const StreamTransformerWrapper(this._transformer); | 14 const StreamTransformerWrapper(this._transformer); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 _controller.addError(error, stackTrace); | 51 _controller.addError(error, stackTrace); |
54 } | 52 } |
55 | 53 |
56 Future addStream(Stream<S> stream) => _controller.addStream(stream); | 54 Future addStream(Stream<S> stream) => _controller.addStream(stream); |
57 | 55 |
58 Future close() { | 56 Future close() { |
59 _controller.close(); | 57 _controller.close(); |
60 return _inner.done; | 58 return _inner.done; |
61 } | 59 } |
62 } | 60 } |
OLD | NEW |