| 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 Console _console; | 7 Console _console; |
| 8 | 8 |
| 9 Console get console { | 9 Console get console { |
| 10 if (_console == null) { | 10 if (_console == null) { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * This class has a call method so you can call it directly. Calling | 44 * This class has a call method so you can call it directly. Calling |
| 45 * it directly is the same as calling its `writeln` method. | 45 * it directly is the same as calling its `writeln` method. |
| 46 */ | 46 */ |
| 47 class ConsoleSink implements Sink<List<int>>, StringSink { | 47 class ConsoleSink implements Sink<List<int>>, StringSink { |
| 48 IOSink _sink; | 48 IOSink _sink; |
| 49 | 49 |
| 50 ConsoleSink._(int fd) { | 50 ConsoleSink._(int fd) { |
| 51 _sink = new IOSink(new _ConsoleConsumer(fd)); | 51 _sink = new IOSink(new _ConsoleConsumer(fd)); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void call(Object message) => _sink.writeln(message); | 54 void call([Object message = ""]) => _sink.writeln(message); |
| 55 | 55 |
| 56 void add(List<int> data) => _sink.add(data); | 56 void add(List<int> data) => _sink.add(data); |
| 57 | 57 |
| 58 void close() {} | 58 void close() {} |
| 59 | 59 |
| 60 void write(Object obj) => _sink.write(obj); | 60 void write(Object obj) => _sink.write(obj); |
| 61 | 61 |
| 62 void writeAll(Iterable objects, [String separator=""]) => | 62 void writeAll(Iterable objects, [String separator=""]) => |
| 63 _sink.writeAll(objects, separator); | 63 _sink.writeAll(objects, separator); |
| 64 | 64 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 88 onDone: completer.complete, | 88 onDone: completer.complete, |
| 89 cancelOnError: true); | 89 cancelOnError: true); |
| 90 return completer.future; | 90 return completer.future; |
| 91 } | 91 } |
| 92 | 92 |
| 93 Future close() { | 93 Future close() { |
| 94 _file.closeSync(); | 94 _file.closeSync(); |
| 95 return new Future.value(); | 95 return new Future.value(); |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |