Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: sdk/lib/convert/encoding.dart

Issue 22872012: Remove Encoding-enum from dart:io and add interface in dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix ddbg. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 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 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 part of dart.convert; 5 part of dart.convert;
6 6
7 /** 7 /**
8 * Open-ended Encoding enum. 8 * Open-ended Encoding enum.
9 */ 9 */
10 // TODO(floitsch): dart:io already has an Encoding class. If we can't 10 abstract class Encoding extends Codec<String, List<int>> {
11 // consolitate them, we need to remove `Encoding` here. 11 const Encoding();
12 abstract class _Encoding extends Codec<String, List<int>> {
13 const _Encoding();
14 12
15 // TODO(floitsch): should we introduce a StringToByteEncoder and 13 Future<String> decodeStream(Stream<List<int>> byteStream) {
16 // a ByteToStringDecoder so that we have better typing? 14 return byteStream
15 .transform(decoder)
16 .fold(new StringBuffer(), (buffer, string) => buffer..write(string))
17 .then((buffer) => buffer.toString());
18 }
19
20 /**
21 * Name of the encoding.
22 *
23 * If the encoding is standardized, this is the lower-case version of one of
24 * the IANA official names for the character set (see
25 * http://www.iana.org/assignments/character-sets/character-sets.xml)
26 */
27 String get name;
17 } 28 }
18
19 // TODO(floitsch): add other encodings, like ASCII and ISO_8859_1.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698