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

Side by Side Diff: sdk/lib/io/string_transformer.dart

Issue 12440002: Make instances of HeaderValue and ContentType immutable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from nweiz@ Created 7 years, 9 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/io/http_headers.dart ('k') | tests/standalone/io/http_advanced_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
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.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * String encodings. 8 * String encodings.
9 */ 9 */
10 class Encoding { 10 class Encoding {
11 static const Encoding UTF_8 = const Encoding._internal("UTF-8"); 11 static const Encoding UTF_8 = const Encoding._internal("utf-8");
12 static const Encoding ISO_8859_1 = const Encoding._internal("ISO-8859-1"); 12 static const Encoding ISO_8859_1 = const Encoding._internal("iso-8859-1");
13 static const Encoding ASCII = const Encoding._internal("ASCII"); 13 static const Encoding ASCII = const Encoding._internal("us-ascii");
14
15 /**
16 * Name of the encoding. This will be the lower-case version of one of the
17 * IANA official names for the character set (see
18 * http://www.iana.org/assignments/character-sets/character-sets.xml)
19 */
20 final String name;
21
14 /** 22 /**
15 * SYSTEM encoding is the current code page on Windows and UTF-8 on 23 * SYSTEM encoding is the current code page on Windows and UTF-8 on
16 * Linux and Mac. 24 * Linux and Mac.
17 */ 25 */
18 static const Encoding SYSTEM = const Encoding._internal("SYSTEM"); 26 static const Encoding SYSTEM = const Encoding._internal("system");
19 const Encoding._internal(String this.name); 27 const Encoding._internal(String this.name);
20 final String name;
21 } 28 }
22 29
23 30
24 /** 31 /**
25 * Stream transformer that can decode a stream of bytes into a stream of 32 * Stream transformer that can decode a stream of bytes into a stream of
26 * strings using [encoding]. 33 * strings using [encoding].
27 * 34 *
28 * Invalid or forbidden byte-sequences will not produce errors, but will instead 35 * Invalid or forbidden byte-sequences will not produce errors, but will instead
29 * insert [replacementChar] in the decoded strings. 36 * insert [replacementChar] in the decoded strings.
30 */ 37 */
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 313
307 // Utility class for decoding Windows current code page data delivered 314 // Utility class for decoding Windows current code page data delivered
308 // as a stream of bytes. 315 // as a stream of bytes.
309 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String> { 316 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String> {
310 void handleData(List<int> data, StreamSink<String> sink) { 317 void handleData(List<int> data, StreamSink<String> sink) {
311 sink.add(_decodeBytes(data)); 318 sink.add(_decodeBytes(data));
312 } 319 }
313 320
314 external static String _decodeBytes(List<int> bytes); 321 external static String _decodeBytes(List<int> bytes);
315 } 322 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | tests/standalone/io/http_advanced_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698