| 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. |
| 9 */ |
| 10 class Encoding { |
| 11 static const Encoding UTF_8 = const Encoding._internal("UTF-8"); |
| 12 static const Encoding ISO_8859_1 = const Encoding._internal("ISO-8859-1"); |
| 13 static const Encoding ASCII = const Encoding._internal("ASCII"); |
| 14 /** |
| 15 * SYSTEM encoding is the current code page on Windows and UTF-8 on |
| 16 * Linux and Mac. |
| 17 */ |
| 18 static const Encoding SYSTEM = const Encoding._internal("SYSTEM"); |
| 19 const Encoding._internal(String this.name); |
| 20 final String name; |
| 21 } |
| 22 |
| 23 |
| 24 /** |
| 8 * Stream transformer that can decode a stream of bytes into a stream of | 25 * Stream transformer that can decode a stream of bytes into a stream of |
| 9 * strings using [encoding]. | 26 * strings using [encoding]. |
| 10 * | 27 * |
| 11 * Invalid or forbidden byte-sequences will not produce errors, but will instead | 28 * Invalid or forbidden byte-sequences will not produce errors, but will instead |
| 12 * insert [replacementChar] in the decoded strings. | 29 * insert [replacementChar] in the decoded strings. |
| 13 */ | 30 */ |
| 14 class StringDecoder implements StreamTransformer<List<int>, String> { | 31 class StringDecoder implements StreamTransformer<List<int>, String> { |
| 15 var _decoder; | 32 var _decoder; |
| 16 | 33 |
| 17 /** | 34 /** |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 _subscription.resume(); | 405 _subscription.resume(); |
| 389 } | 406 } |
| 390 } | 407 } |
| 391 | 408 |
| 392 void _subscriptionChanged() { | 409 void _subscriptionChanged() { |
| 393 if (!_controller.hasSubscribers) { | 410 if (!_controller.hasSubscribers) { |
| 394 _subscription.cancel(); | 411 _subscription.cancel(); |
| 395 } | 412 } |
| 396 } | 413 } |
| 397 } | 414 } |
| OLD | NEW |