| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /** | |
| 6 * | |
| 7 * Encoders and decoders for converting between different data representations, | |
| 8 * including JSON and UTF-8. | |
| 9 * | |
| 10 * In addition to converters for common data representations, this library | |
| 11 * provides support for implementing converters in a way which makes them easy t
o | |
| 12 * chain and to use with streams. | |
| 13 * | |
| 14 * To use this library in your code: | |
| 15 * | |
| 16 * import 'dart:convert'; | |
| 17 * | |
| 18 * Two commonly used converters are the top-level instances of | |
| 19 * [JsonCodec] and [Utf8Codec], named JSON and UTF8, respectively. | |
| 20 * | |
| 21 * JSON is a simple text format for representing | |
| 22 * structured objects and collections. | |
| 23 * The JSON encoder/decoder transforms between strings and | |
| 24 * object structures, such as lists and maps, using the JSON format. | |
| 25 * | |
| 26 * UTF-8 is a common variable-width encoding that can represent | |
| 27 * every character in the Unicode character set. | |
| 28 * The UTF-8 encoder/decoder transforms between Strings and bytes. | |
| 29 * | |
| 30 * Converters are often used with streams | |
| 31 * to transform the data that comes through the stream | |
| 32 * as it becomes available. | |
| 33 * The following code uses two converters. | |
| 34 * The first is a UTF-8 decoder, which converts the data from bytes to UTF-8 | |
| 35 * as it's read from a file, | |
| 36 * The second is an instance of [LineSplitter], | |
| 37 * which splits the data on newline boundaries. | |
| 38 * | |
| 39 * int lineNumber = 1; | |
| 40 * Stream<List<int>> stream = new File('quotes.txt').openRead(); | |
| 41 * | |
| 42 * stream.transform(UTF8.decoder) | |
| 43 * .transform(const LineSplitter()) | |
| 44 * .listen((line) { | |
| 45 * if (showLineNumbers) { | |
| 46 * stdout.write('${lineNumber++} '); | |
| 47 * } | |
| 48 * stdout.writeln(line); | |
| 49 * }); | |
| 50 * | |
| 51 * See the documentation for the [Codec] and [Converter] classes | |
| 52 * for information about creating your own converters. | |
| 53 */ | |
| 54 library dart.convert; | |
| 55 | |
| 56 import 'dart:async'; | |
| 57 import 'dart:typed_data'; | |
| 58 | |
| 59 part 'ascii.dart'; | |
| 60 part 'base64.dart'; | |
| 61 part 'byte_conversion.dart'; | |
| 62 part 'chunked_conversion.dart'; | |
| 63 part 'codec.dart'; | |
| 64 part 'converter.dart'; | |
| 65 part 'encoding.dart'; | |
| 66 part 'html_escape.dart'; | |
| 67 part 'json.dart'; | |
| 68 part 'latin1.dart'; | |
| 69 part 'line_splitter.dart'; | |
| 70 part 'string_conversion.dart'; | |
| 71 part 'utf.dart'; | |
| OLD | NEW |