| 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>>] and provide |    8  * Helper class to wrap a [StreamConsumer<List<int>>] 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 all [StringSink] methods and will delay |   10  * [IOSink] buffers the input given by all [StringSink] methods and will delay | 
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  125   } |  125   } | 
|  126  |  126  | 
|  127   StreamController<T> get _controller { |  127   StreamController<T> get _controller { | 
|  128     if (_isBound) { |  128     if (_isBound) { | 
|  129       throw new StateError("StreamSink is bound to a stream"); |  129       throw new StateError("StreamSink is bound to a stream"); | 
|  130     } |  130     } | 
|  131     if (_isClosed) { |  131     if (_isClosed) { | 
|  132       throw new StateError("StreamSink is closed"); |  132       throw new StateError("StreamSink is closed"); | 
|  133     } |  133     } | 
|  134     if (_controllerInstance == null) { |  134     if (_controllerInstance == null) { | 
|  135       _controllerInstance = new StreamController<T>(); |  135       _controllerInstance = new StreamController<T>(sync: true); | 
|  136       _controllerCompleter = new Completer(); |  136       _controllerCompleter = new Completer(); | 
|  137       _target.addStream(_controller.stream) |  137       _target.addStream(_controller.stream) | 
|  138           .then( |  138           .then( | 
|  139               (_) { |  139               (_) { | 
|  140                 if (_isBound) { |  140                 if (_isBound) { | 
|  141                   // A new stream takes over - forward values to that stream. |  141                   // A new stream takes over - forward values to that stream. | 
|  142                   _controllerCompleter.complete(); |  142                   _controllerCompleter.complete(); | 
|  143                   _controllerCompleter = null; |  143                   _controllerCompleter = null; | 
|  144                   _controllerInstance = null; |  144                   _controllerInstance = null; | 
|  145                 } else { |  145                 } else { | 
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  216  |  216  | 
|  217   void writeln([Object obj = ""]) { |  217   void writeln([Object obj = ""]) { | 
|  218     write(obj); |  218     write(obj); | 
|  219     write("\n"); |  219     write("\n"); | 
|  220   } |  220   } | 
|  221  |  221  | 
|  222   void writeCharCode(int charCode) { |  222   void writeCharCode(int charCode) { | 
|  223     write(new String.fromCharCode(charCode)); |  223     write(new String.fromCharCode(charCode)); | 
|  224   } |  224   } | 
|  225 } |  225 } | 
| OLD | NEW |