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

Side by Side Diff: sdk/lib/io/io_sink.dart

Issue 13945009: Make default argument to Iterable.join be "". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 8 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/io/http_impl.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.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.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Helper class to wrap a [StreamConsumer<List<int>, T>] and provide 8 * Helper class to wrap a [StreamConsumer<List<int>, T>] and provide
9 * utility functions for writing to the StreamConsumer directly. The 9 * utility functions for writing to the StreamConsumer directly. The
10 * [IOSink] buffers the input given by [write], [writeAll], [writeln], 10 * [IOSink] buffers the input given by [write], [writeAll], [writeln],
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 throw new ArgumentError('toString() did not return a string'); 99 throw new ArgumentError('toString() did not return a string');
100 } 100 }
101 } 101 }
102 if (string.isEmpty) return; 102 if (string.isEmpty) return;
103 writeBytes(_encodeString(string, _encoding)); 103 writeBytes(_encodeString(string, _encoding));
104 } 104 }
105 105
106 void writeAll(Iterable objects, [String separator = ""]) { 106 void writeAll(Iterable objects, [String separator = ""]) {
107 Iterator iterator = objects.iterator; 107 Iterator iterator = objects.iterator;
108 if (!iterator.moveNext()) return; 108 if (!iterator.moveNext()) return;
109 if (separator == "") { 109 if (separator.isEmpty) {
110 do { 110 do {
111 write(iterator.current); 111 write(iterator.current);
112 } while (iterator.moveNext()); 112 } while (iterator.moveNext());
113 } else { 113 } else {
114 write(iterator.current); 114 write(iterator.current);
115 while (iterator.moveNext()) { 115 while (iterator.moveNext()) {
116 write(separator); 116 write(separator);
117 write(iterator.current); 117 write(iterator.current);
118 } 118 }
119 } 119 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 }, 251 },
252 onError: _controller.addError); 252 onError: _controller.addError);
253 if (_paused) _pause(); 253 if (_paused) _pause();
254 if (unbind) { 254 if (unbind) {
255 return _writeStreamCompleter.future; 255 return _writeStreamCompleter.future;
256 } else { 256 } else {
257 return _pipeFuture; 257 return _pipeFuture;
258 } 258 }
259 } 259 }
260 } 260 }
OLDNEW
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | sdk/lib/svg/dart2js/svg_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698