| 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 'package:charcode/ascii.dart'; | 7 import 'package:charcode/ascii.dart'; |
| 8 | 8 |
| 9 import 'encoder_sink.dart'; | 9 import 'encoder_sink.dart'; |
| 10 | 10 |
| 11 /// A String representing a mapping from numbers between 0 and 63, inclusive, to | 11 /// A String representing a mapping from numbers between 0 and 63, inclusive, to |
| 12 /// their corresponding encoded character. | 12 /// their corresponding encoded character. |
| 13 /// | 13 /// |
| 14 /// This is the table for URL-safe encodings. | 14 /// This is the table for URL-safe encodings. |
| 15 const _encodeTableUrlSafe = | 15 const _encodeTableUrlSafe = |
| 16 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; | 16 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; |
| 17 | 17 |
| 18 /// A String representing a mapping from numbers between 0 and 63, inclusive, to | 18 /// A String representing a mapping from numbers between 0 and 63, inclusive, to |
| 19 /// their corresponding encoded character. | 19 /// their corresponding encoded character. |
| 20 /// | 20 /// |
| 21 /// This is the table for URL-unsafe encodings. | 21 /// This is the table for URL-unsafe encodings. |
| 22 const _encodeTable = | 22 const _encodeTable = |
| 23 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 23 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
| 24 | 24 |
| 25 /// The line length for Base64 strings with line separators. | 25 /// The line length for Base64 strings with line separators. |
| 26 const _lineLength = 76; | 26 const _lineLength = 76; |
| 27 | 27 |
| 28 /// An encoder that converts sequences of bytes to strings using [Base64][rfc]. | 28 /// This is deprecated. |
| 29 /// | 29 /// |
| 30 /// [rfc]: https://tools.ietf.org/html/rfc4648 | 30 /// Use the `Base64Encoder` class in `dart:convert` instead. |
| 31 @Deprecated("Will be removed in crypto 1.0.0.") |
| 31 class Base64Encoder extends Converter<List<int>, String> { | 32 class Base64Encoder extends Converter<List<int>, String> { |
| 32 /// Whether this encoder generates URL-safe strings. | 33 /// Whether this encoder generates URL-safe strings. |
| 33 final bool _urlSafe; | 34 final bool _urlSafe; |
| 34 | 35 |
| 35 /// Whether this encoder adds line breaks to the output. | 36 /// Whether this encoder adds line breaks to the output. |
| 36 final bool _addLineSeparator; | 37 final bool _addLineSeparator; |
| 37 | 38 |
| 38 /// The sequence of bytes to use as a padding character. | 39 /// The sequence of bytes to use as a padding character. |
| 39 final List<int> _pad; | 40 final List<int> _pad; |
| 40 | 41 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 } | 141 } |
| 141 | 142 |
| 142 Base64EncoderSink startChunkedConversion(Sink<String> sink) { | 143 Base64EncoderSink startChunkedConversion(Sink<String> sink) { |
| 143 StringConversionSink stringSink = sink is StringConversionSink | 144 StringConversionSink stringSink = sink is StringConversionSink |
| 144 ? sink | 145 ? sink |
| 145 : new StringConversionSink.from(sink); | 146 : new StringConversionSink.from(sink); |
| 146 | 147 |
| 147 return new Base64EncoderSink(stringSink, _urlSafe, _addLineSeparator); | 148 return new Base64EncoderSink(stringSink, _urlSafe, _addLineSeparator); |
| 148 } | 149 } |
| 149 } | 150 } |
| OLD | NEW |