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

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

Issue 19000006: First version of Codecs and Converters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comment. Created 7 years, 5 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
« no previous file with comments | « sdk/lib/convert/json.dart ('k') | tests/lib/codec/codec1_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 part of dart.convert;
6
7 /**
8 * A [Utf8Encoder] converts strings to their UTF-8 code units (a list of
9 * unsigned 8-bit integers).
10 */
11 class Utf8Encoder extends Converter<String, List<int>> {
12 /**
13 * Converts [string] to its UTF-8 code units (a list of
14 * unsigned 8-bit integers).
15 */
16 List<int> convert(String string) => OLD_UTF_LIB.encodeUtf8(string);
17 }
18
19 /**
20 * A [Utf8Decoder] converts UTF-8 code units (lists of unsigned 8-bit integers)
21 * to a string.
22 */
23 class Utf8Decoder extends Converter<List<int>, String> {
24 /**
25 * Converts the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
26 * corresponding string.
27 */
28 // TODO(floitsch): allow to configure the decoder (for example the replacement
29 // character).
30 String convert(List<int> codeUnits) => OLD_UTF_LIB.decodeUtf8(codeUnits);
31 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/json.dart ('k') | tests/lib/codec/codec1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698