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

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

Issue 16309014: Add support for binary stdout/stderr data when using Process.run (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Removed debug print Created 7 years, 6 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.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("us-ascii"); 13 static const Encoding ASCII = const Encoding._internal("us-ascii");
14 14
15 /** 15 /**
16 * SYSTEM encoding is the current code page on Windows and UTF-8 on 16 * SYSTEM encoding is the current code page on Windows and UTF-8 on
17 * Linux and Mac. 17 * Linux and Mac.
18 */ 18 */
19 static const Encoding SYSTEM = const Encoding._internal("system"); 19 static const Encoding SYSTEM = const Encoding._internal("system");
20 20
21 /**
22 * BINARY encoding is used to specify that no encoding is used and
23 * binary data is expected.
24 */
25 static const Encoding BINARY = const Encoding._internal("binary");
26
21 // All aliasses (in lowercase) of supported encoding from 27 // All aliasses (in lowercase) of supported encoding from
22 // http://www.iana.org/assignments/character-sets/character-sets.xml. 28 // http://www.iana.org/assignments/character-sets/character-sets.xml.
23 static Map<String, Encoding> _nameToEncoding = <String, Encoding> { 29 static Map<String, Encoding> _nameToEncoding = <String, Encoding> {
24 // ISO_8859-1:1987. 30 // ISO_8859-1:1987.
25 "iso_8859-1:1987": ISO_8859_1, 31 "iso_8859-1:1987": ISO_8859_1,
26 "iso-ir-100": ISO_8859_1, 32 "iso-ir-100": ISO_8859_1,
27 "iso_8859-1": ISO_8859_1, 33 "iso_8859-1": ISO_8859_1,
28 "iso-8859-1": ISO_8859_1, 34 "iso-8859-1": ISO_8859_1,
29 "latin1": ISO_8859_1, 35 "latin1": ISO_8859_1,
30 "l1": ISO_8859_1, 36 "l1": ISO_8859_1,
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 391
386 // Utility class for decoding Windows current code page data delivered 392 // Utility class for decoding Windows current code page data delivered
387 // as a stream of bytes. 393 // as a stream of bytes.
388 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String> { 394 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String> {
389 void handleData(List<int> data, EventSink<String> sink) { 395 void handleData(List<int> data, EventSink<String> sink) {
390 sink.add(_decodeBytes(data)); 396 sink.add(_decodeBytes(data));
391 } 397 }
392 398
393 external static String _decodeBytes(List<int> bytes); 399 external static String _decodeBytes(List<int> bytes);
394 } 400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698