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.convert; | 5 part of dart.convert; |
6 | 6 |
7 /** | 7 /** |
8 * An instance of the default implementation of the [Latin1Codec]. | 8 * An instance of the default implementation of the [Latin1Codec]. |
9 * | 9 * |
10 * This instance provides a convenient access to the most common ISO Latin 1 | 10 * This instance provides a convenient access to the most common ISO Latin 1 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 */ | 90 */ |
91 const Latin1Decoder({ bool allowInvalid: false }) | 91 const Latin1Decoder({ bool allowInvalid: false }) |
92 : super(allowInvalid, _LATIN1_MASK); | 92 : super(allowInvalid, _LATIN1_MASK); |
93 | 93 |
94 /** | 94 /** |
95 * Starts a chunked conversion. | 95 * Starts a chunked conversion. |
96 * | 96 * |
97 * The converter works more efficiently if the given [sink] is a | 97 * The converter works more efficiently if the given [sink] is a |
98 * [StringConversionSink]. | 98 * [StringConversionSink]. |
99 */ | 99 */ |
100 ByteConversionSink startChunkedConversion( | 100 ByteConversionSink startChunkedConversion(Sink<String> sink) { |
101 ChunkedConversionSink<String> sink) { | |
102 StringConversionSink stringSink; | 101 StringConversionSink stringSink; |
103 if (sink is StringConversionSink) { | 102 if (sink is StringConversionSink) { |
104 stringSink = sink; | 103 stringSink = sink; |
105 } else { | 104 } else { |
106 stringSink = new StringConversionSink.from(sink); | 105 stringSink = new StringConversionSink.from(sink); |
107 } | 106 } |
108 // TODO(lrn): Use stringSink.asUtf16Sink() if it becomes available. | 107 // TODO(lrn): Use stringSink.asUtf16Sink() if it becomes available. |
109 return new _Latin1DecoderSink(_allowInvalid, stringSink); | 108 return new _Latin1DecoderSink(_allowInvalid, stringSink); |
110 } | 109 } |
111 } | 110 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 } | 150 } |
152 } | 151 } |
153 } | 152 } |
154 if (start < end) { | 153 if (start < end) { |
155 _addSliceToSink(source, start, end, isLast); | 154 _addSliceToSink(source, start, end, isLast); |
156 } else if (isLast) { | 155 } else if (isLast) { |
157 close(); | 156 close(); |
158 } | 157 } |
159 } | 158 } |
160 } | 159 } |
OLD | NEW |