| 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.utf; | 5 part of dart.utf; |
| 6 | 6 |
| 7 class _HelperStreamController<T> extends StreamController<T> { | |
| 8 final Function onPauseChanged; | |
| 9 | |
| 10 _HelperStreamController(this.onPauseChanged); | |
| 11 | |
| 12 void onPauseStateChange() { | |
| 13 onPauseChanged(); | |
| 14 } | |
| 15 } | |
| 16 | |
| 17 abstract class _StringDecoder | 7 abstract class _StringDecoder |
| 18 extends StreamEventTransformer<List<int>, String> { | 8 extends StreamEventTransformer<List<int>, String> { |
| 19 List<int> _carry; | 9 List<int> _carry; |
| 20 List<int> _buffer; | 10 List<int> _buffer; |
| 21 int _replacementChar; | 11 int _replacementChar; |
| 22 | 12 |
| 23 _StringDecoder(int this._replacementChar); | 13 _StringDecoder(int this._replacementChar); |
| 24 | 14 |
| 25 void handleData(List<int> bytes, EventSink<String> sink) { | 15 void handleData(List<int> bytes, EventSink<String> sink) { |
| 26 try { | 16 try { |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 } | 189 } |
| 200 for (int i = additionalBytes; i > 0; i--) { | 190 for (int i = additionalBytes; i > 0; i--) { |
| 201 // 10xxxxxx (xxxxxx is next 6 bits from the top). | 191 // 10xxxxxx (xxxxxx is next 6 bits from the top). |
| 202 bytes.add(((charCode >> (6 * (i - 1))) & 0x3F) | 0x80); | 192 bytes.add(((charCode >> (6 * (i - 1))) & 0x3F) | 0x80); |
| 203 } | 193 } |
| 204 pos += additionalBytes + 1; | 194 pos += additionalBytes + 1; |
| 205 } | 195 } |
| 206 return bytes; | 196 return bytes; |
| 207 } | 197 } |
| 208 } | 198 } |
| OLD | NEW |