| 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 * 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |