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

Unified Diff: sdk/lib/codec/encoding.dart

Issue 19941002: Remove dart:codec and move classes into dart:convert. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/codec/codec_sources.gypi ('k') | sdk/lib/codec/json.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/codec/encoding.dart
diff --git a/sdk/lib/codec/encoding.dart b/sdk/lib/codec/encoding.dart
deleted file mode 100644
index 40e0f2b4d83ae56b3d58b217c06016e1a13485ad..0000000000000000000000000000000000000000
--- a/sdk/lib/codec/encoding.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of dart.codec;
-
-/**
- * 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();
-}
-
-// TODO(floitsch): add other encodings, like ASCII and ISO_8859_1.
-const UTF8 = const Utf8Codec();
-
-/**
- * A [Utf8Codec] encodes strings to utf-8 code units (bytes) and decodes
- * UTF-8 code units to strings.
- */
-class Utf8Codec extends Encoding {
- final bool _allowMalformed;
-
- /**
- * Instantiates a new [Utf8Codec].
- *
- * The optional [allowMalformed] argument defines how [decoder] (and [decode])
- * deal with invalid or unterminated character sequences.
- *
- * If it is `true` (and not overriden at the method invocation) [decode] and
- * the [decoder] replace invalid (or unterminated) octet
- * sequences with the Unicode Replacement character `U+FFFD` (�). Otherwise
- * they throw a [FormatException].
- */
- const Utf8Codec({ bool allowMalformed: false })
- : _allowMalformed = allowMalformed;
-
- /**
- * Decodes the UTF-8 [codeUnits] (a list of unsigned 8-bit integers) to the
- * corresponding string.
- *
- * If [allowMalformed] is `true` the decoder replaces invalid (or
- * unterminated) character sequences with the Unicode Replacement character
- * `U+FFFD` (�). Otherwise it throws a [FormatException].
- *
- * If [allowMalformed] is not given, it defaults to the `allowMalformed` that
- * was used to instantiate `this`.
- */
- String decode(List<int> codeUnits, { bool allowMalformed }) {
- if (allowMalformed == null) allowMalformed = _allowMalformed;
- return new Utf8Decoder(allowMalformed: allowMalformed).convert(codeUnits);
- }
-
- Converter<String, List<int>> get encoder => new Utf8Encoder();
- Converter<List<int>, String> get decoder {
- return new Utf8Decoder(allowMalformed: _allowMalformed);
- }
-}
« no previous file with comments | « sdk/lib/codec/codec_sources.gypi ('k') | sdk/lib/codec/json.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698