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

Side by Side Diff: sdk/lib/convert/latin1.dart

Issue 203603008: Introduce class Sink<T>. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/convert/json.dart ('k') | sdk/lib/convert/line_splitter.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.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
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
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 }
OLDNEW
« no previous file with comments | « sdk/lib/convert/json.dart ('k') | sdk/lib/convert/line_splitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698