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

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

Issue 1881553002: Revert "Steps towards making the convert library strong-mode compliant." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « sdk/lib/convert/converter.dart ('k') | sdk/lib/convert/html_escape.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 abstract class Encoding extends Codec<String, List<int>> { 10 abstract class Encoding extends Codec<String, List<int>> {
11 const Encoding(); 11 const Encoding();
12 12
13 ChunkedConverter<String, List<int>, String, List<int>> get encoder;
14 ChunkedConverter<List<int>, String, List<int>, String> get decoder;
15
16 Future<String> decodeStream(Stream<List<int>> byteStream) { 13 Future<String> decodeStream(Stream<List<int>> byteStream) {
17 return byteStream 14 return byteStream
18 .transform(decoder) 15 .transform(decoder)
19 .fold(new StringBuffer(), (buffer, string) => buffer..write(string)) 16 .fold(new StringBuffer(), (buffer, string) => buffer..write(string))
20 .then((buffer) => buffer.toString()); 17 .then((buffer) => buffer.toString());
21 } 18 }
22 19
23 /** 20 /**
24 * Name of the encoding. 21 * Name of the encoding.
25 * 22 *
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 * The [name] passed is case insensitive. 67 * The [name] passed is case insensitive.
71 * 68 *
72 * If character set is not supported [:null:] is returned. 69 * If character set is not supported [:null:] is returned.
73 */ 70 */
74 static Encoding getByName(String name) { 71 static Encoding getByName(String name) {
75 if (name == null) return null; 72 if (name == null) return null;
76 name = name.toLowerCase(); 73 name = name.toLowerCase();
77 return _nameToEncoding[name]; 74 return _nameToEncoding[name];
78 } 75 }
79 } 76 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/converter.dart ('k') | sdk/lib/convert/html_escape.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698