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

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

Issue 46663003: Fix sdk/lib/io errors found by the analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: More fixes. Created 7 years, 1 month 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/stdio.dart ('k') | sdk/lib/io/websocket_impl.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 const SYSTEM_ENCODING = const SystemEncoding(); 7 const SYSTEM_ENCODING = const SystemEncoding();
8 8
9 /** 9 /**
10 * The system encoding is the current code page on Windows and UTF-8 on 10 * The system encoding is the current code page on Windows and UTF-8 on
11 * Linux and Mac. 11 * Linux and Mac.
12 */ 12 */
13 class SystemEncoding extends Encoding { 13 class SystemEncoding extends Encoding {
14 const SystemEncoding(); 14 const SystemEncoding();
15 15
16 String get name => 'system';
17
16 List<int> encode(String input) => encoder.convert(input); 18 List<int> encode(String input) => encoder.convert(input);
17 String decode(List<int> encoded) => decoder.convert(encoded); 19 String decode(List<int> encoded) => decoder.convert(encoded);
18 20
19 Converter<String, List<int>> get encoder { 21 Converter<String, List<int>> get encoder {
20 if (Platform.operatingSystem == "windows") { 22 if (Platform.operatingSystem == "windows") {
21 return const _WindowsCodePageEncoder(); 23 return const _WindowsCodePageEncoder();
22 } else { 24 } else {
23 return const Utf8Encoder(); 25 return const Utf8Encoder();
24 } 26 }
25 } 27 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 _WindowsCodePageDecoderSink(this._sink); 122 _WindowsCodePageDecoderSink(this._sink);
121 123
122 void close() { 124 void close() {
123 _sink.close(); 125 _sink.close();
124 } 126 }
125 127
126 void add(List<int> bytes) { 128 void add(List<int> bytes) {
127 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes)); 129 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes));
128 } 130 }
129 } 131 }
OLDNEW
« no previous file with comments | « sdk/lib/io/stdio.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698