| 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 const int _STDIO_HANDLE_TYPE_TERMINAL = 0; | 7 const int _STDIO_HANDLE_TYPE_TERMINAL = 0; |
| 8 const int _STDIO_HANDLE_TYPE_PIPE = 1; | 8 const int _STDIO_HANDLE_TYPE_PIPE = 1; |
| 9 const int _STDIO_HANDLE_TYPE_FILE = 2; | 9 const int _STDIO_HANDLE_TYPE_FILE = 2; |
| 10 const int _STDIO_HANDLE_TYPE_SOCKET = 3; | 10 const int _STDIO_HANDLE_TYPE_SOCKET = 3; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 bool cancelOnError}) { | 22 bool cancelOnError}) { |
| 23 return _stream.listen( | 23 return _stream.listen( |
| 24 onData, | 24 onData, |
| 25 onError: onError, | 25 onError: onError, |
| 26 onDone: onDone, | 26 onDone: onDone, |
| 27 cancelOnError: cancelOnError); | 27 cancelOnError: cancelOnError); |
| 28 } | 28 } |
| 29 } | 29 } |
| 30 | 30 |
| 31 | 31 |
| 32 class _StdinEventSink implements EventSink<String> { | |
| 33 Function _add; | |
| 34 Function _addError; | |
| 35 Function _close; | |
| 36 _StdinEventSink(this._add, this._addError, this._close); | |
| 37 | |
| 38 void add(String string) => _add(string); | |
| 39 void addError(errorEvent) => _addError(errorEvent); | |
| 40 void close() => _close(); | |
| 41 } | |
| 42 | |
| 43 /** | 32 /** |
| 44 * [Stdin] allows both synchronous and asynchronous reads from the standard | 33 * [Stdin] allows both synchronous and asynchronous reads from the standard |
| 45 * input stream. | 34 * input stream. |
| 46 * | 35 * |
| 47 * Mixing synchronous and asynchronous reads is undefined. | 36 * Mixing synchronous and asynchronous reads is undefined. |
| 48 */ | 37 */ |
| 49 class Stdin extends _StdStream implements Stream<List<int>> { | 38 class Stdin extends _StdStream implements Stream<List<int>> { |
| 50 Stdin._(Stream<List<int>> stream) : super(stream); | 39 Stdin._(Stream<List<int>> stream) : super(stream); |
| 51 | 40 |
| 52 /** | 41 /** |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 236 } |
| 248 return StdioType.OTHER; | 237 return StdioType.OTHER; |
| 249 } | 238 } |
| 250 | 239 |
| 251 | 240 |
| 252 class _StdIOUtils { | 241 class _StdIOUtils { |
| 253 external static IOSink _getStdioOutputStream(int fd); | 242 external static IOSink _getStdioOutputStream(int fd); |
| 254 external static Stdin _getStdioInputStream(); | 243 external static Stdin _getStdioInputStream(); |
| 255 external static int _socketType(nativeSocket); | 244 external static int _socketType(nativeSocket); |
| 256 } | 245 } |
| OLD | NEW |