| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:convert'; | 5 import 'dart:convert'; |
| 6 | 6 |
| 7 import 'encoder.dart'; | 7 import 'encoder.dart'; |
| 8 | 8 |
| 9 /// A [ChunkedConversionSink] for encoding chunks of data to Base64. | 9 /// This is deprecated. |
| 10 /// |
| 11 /// Use the `Base64Encoder` class in `dart:convert` instead. |
| 12 @Deprecated("Will be removed in crypto 1.0.0.") |
| 10 class Base64EncoderSink extends ChunkedConversionSink<List<int>> { | 13 class Base64EncoderSink extends ChunkedConversionSink<List<int>> { |
| 11 /// The encoder used to encode each chunk. | 14 /// The encoder used to encode each chunk. |
| 12 final Base64Encoder _encoder; | 15 final Base64Encoder _encoder; |
| 13 | 16 |
| 14 /// The underlying sink to which to emit the encoded strings. | 17 /// The underlying sink to which to emit the encoded strings. |
| 15 final ChunkedConversionSink<String> _outSink; | 18 final ChunkedConversionSink<String> _outSink; |
| 16 | 19 |
| 17 /// The buffer of as-yet-unconverted bytes. | 20 /// The buffer of as-yet-unconverted bytes. |
| 18 /// | 21 /// |
| 19 /// This is used to ensure that we don't generate interstitial padding | 22 /// This is used to ensure that we don't generate interstitial padding |
| (...skipping 25 matching lines...) Expand all Loading... |
| 45 } | 48 } |
| 46 | 49 |
| 47 void close() { | 50 void close() { |
| 48 if (_bufferCount > 0) { | 51 if (_bufferCount > 0) { |
| 49 _outSink.add(_encoder.convert(_buffer.sublist(0, _bufferCount))); | 52 _outSink.add(_encoder.convert(_buffer.sublist(0, _bufferCount))); |
| 50 } | 53 } |
| 51 _outSink.close(); | 54 _outSink.close(); |
| 52 } | 55 } |
| 53 } | 56 } |
| 54 | 57 |
| OLD | NEW |