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 class _HttpIncoming extends Stream<List<int>> { | 7 class _HttpIncoming extends Stream<List<int>> { |
8 final int _transferLength; | 8 final int _transferLength; |
9 final Completer _dataCompleter = new Completer(); | 9 final Completer _dataCompleter = new Completer(); |
10 Stream<List<int>> _stream; | 10 Stream<List<int>> _stream; |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 } else { | 368 } else { |
369 string = obj.toString(); | 369 string = obj.toString(); |
370 if (string is! String) { | 370 if (string is! String) { |
371 throw new ArgumentError('toString() did not return a string'); | 371 throw new ArgumentError('toString() did not return a string'); |
372 } | 372 } |
373 } | 373 } |
374 if (string.isEmpty) return; | 374 if (string.isEmpty) return; |
375 _ioSink.write(string); | 375 _ioSink.write(string); |
376 } | 376 } |
377 | 377 |
378 void writeAll(Iterable objects) { | 378 void writeAll(Iterable objects, [String separator = ""]) { |
379 for (Object obj in objects) write(obj); | 379 bool isFirst = true; |
| 380 for (Object obj in objects) { |
| 381 if (isFirst) { |
| 382 isFirst = false; |
| 383 } else { |
| 384 if (separator != "") write(separator); |
| 385 } |
| 386 write(obj); |
| 387 } |
380 } | 388 } |
381 | 389 |
382 void writeln([Object obj = ""]) { | 390 void writeln([Object obj = ""]) { |
383 write(obj); | 391 write(obj); |
384 write("\n"); | 392 write("\n"); |
385 } | 393 } |
386 | 394 |
387 void writeCharCode(int charCode) { | 395 void writeCharCode(int charCode) { |
388 write(new String.fromCharCode(charCode)); | 396 write(new String.fromCharCode(charCode)); |
389 } | 397 } |
(...skipping 1238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 void set encoding(Encoding value) { | 1636 void set encoding(Encoding value) { |
1629 _socket.encoding = value; | 1637 _socket.encoding = value; |
1630 } | 1638 } |
1631 | 1639 |
1632 void write(Object obj) => _socket.write(obj); | 1640 void write(Object obj) => _socket.write(obj); |
1633 | 1641 |
1634 void writeln([Object obj = ""]) => _socket.writeln(obj); | 1642 void writeln([Object obj = ""]) => _socket.writeln(obj); |
1635 | 1643 |
1636 void writeCharCode(int charCode) => _socket.writeCharCode(charCode); | 1644 void writeCharCode(int charCode) => _socket.writeCharCode(charCode); |
1637 | 1645 |
1638 void writeAll(Iterable objects) => _socket.writeAll(objects); | 1646 void writeAll(Iterable objects, [String separator = ""]) { |
| 1647 _socket.writeAll(objects, separator); |
| 1648 } |
1639 | 1649 |
1640 void writeBytes(List<int> bytes) => _socket.writeBytes(bytes); | 1650 void writeBytes(List<int> bytes) => _socket.writeBytes(bytes); |
1641 | 1651 |
1642 Future<Socket> consume(Stream<List<int>> stream) { | 1652 Future<Socket> consume(Stream<List<int>> stream) { |
1643 return _socket.consume(stream); | 1653 return _socket.consume(stream); |
1644 } | 1654 } |
1645 | 1655 |
1646 Future<Socket> writeStream(Stream<List<int>> stream) { | 1656 Future<Socket> writeStream(Stream<List<int>> stream) { |
1647 return _socket.writeStream(stream); | 1657 return _socket.writeStream(stream); |
1648 } | 1658 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1770 | 1780 |
1771 | 1781 |
1772 class _RedirectInfo implements RedirectInfo { | 1782 class _RedirectInfo implements RedirectInfo { |
1773 const _RedirectInfo(int this.statusCode, | 1783 const _RedirectInfo(int this.statusCode, |
1774 String this.method, | 1784 String this.method, |
1775 Uri this.location); | 1785 Uri this.location); |
1776 final int statusCode; | 1786 final int statusCode; |
1777 final String method; | 1787 final String method; |
1778 final Uri location; | 1788 final Uri location; |
1779 } | 1789 } |
OLD | NEW |