| 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.convert; | 5 part of dart.convert; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A [Converter] converts data from one representation into another. | 8 * A [Converter] converts data from one representation into another. |
| 9 * | 9 * |
| 10 * It is recommended that implementations of `Converter` extend this class, | 10 * It is recommended that implementations of `Converter` extend this class, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return new Stream<T>.eventTransformed( | 43 return new Stream<T>.eventTransformed( |
| 44 stream, (EventSink sink) => new _ConverterStreamEventSink(this, sink)); | 44 stream, (EventSink sink) => new _ConverterStreamEventSink(this, sink)); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 /** | 48 /** |
| 49 * Fuses two converters. | 49 * Fuses two converters. |
| 50 * | 50 * |
| 51 * For a non-chunked conversion converts the input in sequence. | 51 * For a non-chunked conversion converts the input in sequence. |
| 52 */ | 52 */ |
| 53 class _FusedConverter<S, M, T> extends Converter<S, T> | 53 class _FusedConverter<S, M, T> extends Converter<S, T> { |
| 54 implements ChunkedConverter<S, T, S, T> { | |
| 55 final Converter<S, M> _first; | 54 final Converter<S, M> _first; |
| 56 final Converter<M, T> _second; | 55 final Converter<M, T> _second; |
| 57 | 56 |
| 58 _FusedConverter(this._first, this._second); | 57 _FusedConverter(this._first, this._second); |
| 59 | 58 |
| 60 T convert(S input) => _second.convert(_first.convert(input)); | 59 T convert(S input) => _second.convert(_first.convert(input)); |
| 61 | 60 |
| 62 Sink/*<S>*/ startChunkedConversion(Sink/*<T>*/ sink) { | 61 Sink/*<S>*/ startChunkedConversion(Sink/*<T>*/ sink) { |
| 63 return _first.startChunkedConversion(_second.startChunkedConversion(sink)); | 62 return _first.startChunkedConversion(_second.startChunkedConversion(sink)); |
| 64 } | 63 } |
| 65 } | 64 } |
| OLD | NEW |