| 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 library crypto.base64.encoder_sink; | |
| 6 | |
| 7 import 'dart:convert'; | 5 import 'dart:convert'; |
| 8 | 6 |
| 9 import 'encoder.dart'; | 7 import 'encoder.dart'; |
| 10 | 8 |
| 11 /// A [ChunkedConversionSink] for encoding chunks of data to Base64. | 9 /// A [ChunkedConversionSink] for encoding chunks of data to Base64. |
| 12 class Base64EncoderSink extends ChunkedConversionSink<List<int>> { | 10 class Base64EncoderSink extends ChunkedConversionSink<List<int>> { |
| 13 /// The encoder used to encode each chunk. | 11 /// The encoder used to encode each chunk. |
| 14 final Base64Encoder _encoder; | 12 final Base64Encoder _encoder; |
| 15 | 13 |
| 16 /// The underlying sink to which to emit the encoded strings. | 14 /// The underlying sink to which to emit the encoded strings. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 47 } | 45 } |
| 48 | 46 |
| 49 void close() { | 47 void close() { |
| 50 if (_bufferCount > 0) { | 48 if (_bufferCount > 0) { |
| 51 _outSink.add(_encoder.convert(_buffer.sublist(0, _bufferCount))); | 49 _outSink.add(_encoder.convert(_buffer.sublist(0, _bufferCount))); |
| 52 } | 50 } |
| 53 _outSink.close(); | 51 _outSink.close(); |
| 54 } | 52 } |
| 55 } | 53 } |
| 56 | 54 |
| OLD | NEW |