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

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

Issue 2754013002: Format all dart: library files (Closed)
Patch Set: Format all dart: library files Created 3 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
« no previous file with comments | « sdk/lib/io/stdio.dart ('k') | sdk/lib/io/websocket.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 /// The current system encoding. 7 /// The current system encoding.
8 /// 8 ///
9 /// This us used for converting from bytes to/from String when 9 /// This us used for converting from bytes to/from String when
10 /// communicating on stdin, stdout and stderr. 10 /// communicating on stdin, stdout and stderr.
(...skipping 26 matching lines...) Expand all
37 if (Platform.operatingSystem == "windows") { 37 if (Platform.operatingSystem == "windows") {
38 return const _WindowsCodePageDecoder(); 38 return const _WindowsCodePageDecoder();
39 } else { 39 } else {
40 return const Utf8Decoder(); 40 return const Utf8Decoder();
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 class _WindowsCodePageEncoder extends Converter<String, List<int>> 45 class _WindowsCodePageEncoder extends Converter<String, List<int>>
46 implements ChunkedConverter<String, List<int>, String, List<int>> { 46 implements ChunkedConverter<String, List<int>, String, List<int>> {
47
48 const _WindowsCodePageEncoder(); 47 const _WindowsCodePageEncoder();
49 48
50 List<int> convert(String input) { 49 List<int> convert(String input) {
51 List<int> encoded = _encodeString(input); 50 List<int> encoded = _encodeString(input);
52 if (encoded == null) { 51 if (encoded == null) {
53 throw new FormatException("Invalid character for encoding"); 52 throw new FormatException("Invalid character for encoding");
54 } 53 }
55 return encoded; 54 return encoded;
56 } 55 }
57 56
(...skipping 29 matching lines...) Expand all
87 86
88 void addSlice(String source, int start, int end, bool isLast) { 87 void addSlice(String source, int start, int end, bool isLast) {
89 if (start != 0 || end != source.length) { 88 if (start != 0 || end != source.length) {
90 source = source.substring(start, end); 89 source = source.substring(start, end);
91 } 90 }
92 add(source); 91 add(source);
93 if (isLast) close(); 92 if (isLast) close();
94 } 93 }
95 } 94 }
96 95
97
98 class _WindowsCodePageDecoder extends Converter<List<int>, String> 96 class _WindowsCodePageDecoder extends Converter<List<int>, String>
99 implements ChunkedConverter<List<int>, String, List<int>, String> { 97 implements ChunkedConverter<List<int>, String, List<int>, String> {
100
101 const _WindowsCodePageDecoder(); 98 const _WindowsCodePageDecoder();
102 99
103 String convert(List<int> input) { 100 String convert(List<int> input) {
104 return _decodeBytes(input); 101 return _decodeBytes(input);
105 } 102 }
106 103
107 /** 104 /**
108 * Starts a chunked conversion. 105 * Starts a chunked conversion.
109 */ 106 */
110 ByteConversionSink startChunkedConversion(Sink<String> sink) { 107 ByteConversionSink startChunkedConversion(Sink<String> sink) {
(...skipping 12 matching lines...) Expand all
123 _WindowsCodePageDecoderSink(this._sink); 120 _WindowsCodePageDecoderSink(this._sink);
124 121
125 void close() { 122 void close() {
126 _sink.close(); 123 _sink.close();
127 } 124 }
128 125
129 void add(List<int> bytes) { 126 void add(List<int> bytes) {
130 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes)); 127 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes));
131 } 128 }
132 } 129 }
OLDNEW
« no previous file with comments | « sdk/lib/io/stdio.dart ('k') | sdk/lib/io/websocket.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698