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

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

Issue 1904553006: Fix strong mode errors in dart:io. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix directory_list rename for dartium. Created 4 years, 7 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_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 /// 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return encoded; 54 return encoded;
55 } 55 }
56 56
57 /** 57 /**
58 * Starts a chunked conversion. 58 * Starts a chunked conversion.
59 */ 59 */
60 StringConversionSink startChunkedConversion(Sink<List<int>> sink) { 60 StringConversionSink startChunkedConversion(Sink<List<int>> sink) {
61 return new _WindowsCodePageEncoderSink(sink); 61 return new _WindowsCodePageEncoderSink(sink);
62 } 62 }
63 63
64 // Override the base-class' bind, to provide a better type.
65 Stream<List<int>> bind(Stream<String> stream) => super.bind(stream);
66
67 external static List<int> _encodeString(String string); 64 external static List<int> _encodeString(String string);
68 } 65 }
69 66
70 class _WindowsCodePageEncoderSink extends StringConversionSinkBase { 67 class _WindowsCodePageEncoderSink extends StringConversionSinkBase {
71 // TODO(floitsch): provide more efficient conversions when the input is 68 // TODO(floitsch): provide more efficient conversions when the input is
72 // not a String. 69 // not a String.
73 70
74 final Sink<List<int>> _sink; 71 final Sink<List<int>> _sink;
75 72
76 _WindowsCodePageEncoderSink(this._sink); 73 _WindowsCodePageEncoderSink(this._sink);
(...skipping 28 matching lines...) Expand all
105 return _decodeBytes(input); 102 return _decodeBytes(input);
106 } 103 }
107 104
108 /** 105 /**
109 * Starts a chunked conversion. 106 * Starts a chunked conversion.
110 */ 107 */
111 ByteConversionSink startChunkedConversion(Sink<String> sink) { 108 ByteConversionSink startChunkedConversion(Sink<String> sink) {
112 return new _WindowsCodePageDecoderSink(sink); 109 return new _WindowsCodePageDecoderSink(sink);
113 } 110 }
114 111
115 // Override the base-class' bind, to provide a better type.
116 Stream<String> bind(Stream<List<int>> stream) => super.bind(stream);
117
118 external static String _decodeBytes(List<int> bytes); 112 external static String _decodeBytes(List<int> bytes);
119 } 113 }
120 114
121 class _WindowsCodePageDecoderSink extends ByteConversionSinkBase { 115 class _WindowsCodePageDecoderSink extends ByteConversionSinkBase {
122 // TODO(floitsch): provide more efficient conversions when the input is 116 // TODO(floitsch): provide more efficient conversions when the input is
123 // a slice. 117 // a slice.
124 118
125 final Sink<String> _sink; 119 final Sink<String> _sink;
126 120
127 _WindowsCodePageDecoderSink(this._sink); 121 _WindowsCodePageDecoderSink(this._sink);
128 122
129 void close() { 123 void close() {
130 _sink.close(); 124 _sink.close();
131 } 125 }
132 126
133 void add(List<int> bytes) { 127 void add(List<int> bytes) {
134 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes)); 128 _sink.add(_WindowsCodePageDecoder._decodeBytes(bytes));
135 } 129 }
136 } 130 }
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