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; | |
6 | |
7 import 'dart:async'; | 5 import 'dart:async'; |
8 | 6 |
9 import 'stream_sink_transformer/handler_transformer.dart'; | 7 import 'stream_sink_transformer/handler_transformer.dart'; |
10 import 'stream_sink_transformer/stream_transformer_wrapper.dart'; | 8 import 'stream_sink_transformer/stream_transformer_wrapper.dart'; |
11 | 9 |
12 /// A [StreamSinkTransformer] transforms the events being passed to a sink. | 10 /// A [StreamSinkTransformer] transforms the events being passed to a sink. |
13 /// | 11 /// |
14 /// This works on the same principle as a [StreamTransformer]. Each transformer | 12 /// This works on the same principle as a [StreamTransformer]. Each transformer |
15 /// defines a [bind] method that takes in the original [StreamSink] and returns | 13 /// defines a [bind] method that takes in the original [StreamSink] and returns |
16 /// the transformed version. However, where a [StreamTransformer] transforms | 14 /// the transformed version. However, where a [StreamTransformer] transforms |
(...skipping 24 matching lines...) Expand all Loading... |
41 void handleDone(EventSink<T> sink)}) { | 39 void handleDone(EventSink<T> sink)}) { |
42 return new HandlerTransformer<S, T>(handleData, handleError, handleDone); | 40 return new HandlerTransformer<S, T>(handleData, handleError, handleDone); |
43 } | 41 } |
44 | 42 |
45 /// Transforms the events passed to [sink]. | 43 /// Transforms the events passed to [sink]. |
46 /// | 44 /// |
47 /// Creates a new sink. When events are passed to the returned sink, it will | 45 /// Creates a new sink. When events are passed to the returned sink, it will |
48 /// transform them and pass the transformed versions to [sink]. | 46 /// transform them and pass the transformed versions to [sink]. |
49 StreamSink<S> bind(StreamSink<T> sink); | 47 StreamSink<S> bind(StreamSink<T> sink); |
50 } | 48 } |
OLD | NEW |