| OLD | NEW |
| 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 { |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 .transform(new StringEncoder(encoding)) | 254 .transform(new StringEncoder(encoding)) |
| 255 .listen((data) => bytes = data); | 255 .listen((data) => bytes = data); |
| 256 controller.add(string); | 256 controller.add(string); |
| 257 controller.close(); | 257 controller.close(); |
| 258 assert(bytes != null); | 258 assert(bytes != null); |
| 259 return bytes; | 259 return bytes; |
| 260 } | 260 } |
| 261 | 261 |
| 262 | 262 |
| 263 class LineTransformer extends StreamEventTransformer<String, String> { | 263 class LineTransformer extends StreamEventTransformer<String, String> { |
| 264 const int _LF = 10; | 264 static const int _LF = 10; |
| 265 const int _CR = 13; | 265 static const int _CR = 13; |
| 266 | 266 |
| 267 StringBuffer _buffer = new StringBuffer(); | 267 StringBuffer _buffer = new StringBuffer(); |
| 268 String _carry; | 268 String _carry; |
| 269 | 269 |
| 270 void _handle(String data, EventSink<String> sink, bool isClosing) { | 270 void _handle(String data, EventSink<String> sink, bool isClosing) { |
| 271 if (_carry != null) { | 271 if (_carry != null) { |
| 272 data = _carry + data; | 272 data = _carry + data; |
| 273 _carry = null; | 273 _carry = null; |
| 274 } | 274 } |
| 275 int startPos = 0; | 275 int startPos = 0; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 | 411 |
| 412 // Utility class for decoding Windows current code page data delivered | 412 // Utility class for decoding Windows current code page data delivered |
| 413 // as a stream of bytes. | 413 // as a stream of bytes. |
| 414 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String>
{ | 414 class _WindowsCodePageDecoder extends StreamEventTransformer<List<int>, String>
{ |
| 415 void handleData(List<int> data, EventSink<String> sink) { | 415 void handleData(List<int> data, EventSink<String> sink) { |
| 416 sink.add(_decodeBytes(data)); | 416 sink.add(_decodeBytes(data)); |
| 417 } | 417 } |
| 418 | 418 |
| 419 external static String _decodeBytes(List<int> bytes); | 419 external static String _decodeBytes(List<int> bytes); |
| 420 } | 420 } |
| OLD | NEW |