Index: sdk/lib/convert/encoding.dart |
diff --git a/sdk/lib/convert/encoding.dart b/sdk/lib/convert/encoding.dart |
index 0f6126c25130921fea8c5d9e1a63eccf1b9023dc..6121815a474eaace7e9f4dede77972632801b66b 100644 |
--- a/sdk/lib/convert/encoding.dart |
+++ b/sdk/lib/convert/encoding.dart |
@@ -7,13 +7,22 @@ part of dart.convert; |
/** |
* Open-ended Encoding enum. |
*/ |
-// TODO(floitsch): dart:io already has an Encoding class. If we can't |
-// consolitate them, we need to remove `Encoding` here. |
-abstract class _Encoding extends Codec<String, List<int>> { |
- const _Encoding(); |
+abstract class Encoding extends Codec<String, List<int>> { |
+ const Encoding(); |
- // TODO(floitsch): should we introduce a StringToByteEncoder and |
- // a ByteToStringDecoder so that we have better typing? |
-} |
+ Future<String> decodeStream(Stream<List<int>> byteStream) { |
+ return byteStream |
+ .transform(decoder) |
+ .fold(new StringBuffer(), (buffer, string) => buffer..write(string)) |
+ .then((buffer) => buffer.toString()); |
+ } |
-// TODO(floitsch): add other encodings, like ASCII and ISO_8859_1. |
+ /** |
+ * Name of the encoding. |
+ * |
+ * If the encoding is standardized, this is the lower-case version of one of |
+ * the IANA official names for the character set (see |
+ * http://www.iana.org/assignments/character-sets/character-sets.xml) |
+ */ |
+ String get name; |
+} |