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; |
11 const int _STDIO_HANDLE_TYPE_OTHER = 4; | 11 const int _STDIO_HANDLE_TYPE_OTHER = 4; |
12 | 12 |
13 class _StdStream extends Stream<List<int>> { | 13 class _StdStream extends Stream<List<int>> { |
14 final Stream<List<int>> _stream; | 14 final Stream<List<int>> _stream; |
15 | 15 |
16 _StdStream(Stream<List<int>> this._stream); | 16 _StdStream(Stream<List<int>> this._stream); |
17 | 17 |
18 StreamSubscription<List<int>> listen(void onData(List<int> event), | 18 StreamSubscription<List<int>> listen(void onData(List<int> event), |
19 {void onError(AsyncError error), | 19 {void onError(AsyncError error), |
20 void onDone(), | 20 void onDone(), |
21 bool unsubscribeOnError}) { | 21 bool cancelOnError}) { |
22 return _stream.listen( | 22 return _stream.listen( |
23 onData, | 23 onData, |
24 onError: onError, | 24 onError: onError, |
25 onDone: onDone, | 25 onDone: onDone, |
26 unsubscribeOnError: unsubscribeOnError); | 26 cancelOnError: cancelOnError); |
27 } | 27 } |
28 } | 28 } |
29 | 29 |
30 class _StdSink implements IOSink { | 30 class _StdSink implements IOSink { |
31 final IOSink _sink; | 31 final IOSink _sink; |
32 | 32 |
33 _StdSink(IOSink this._sink); | 33 _StdSink(IOSink this._sink); |
34 | 34 |
35 Encoding get encoding => _sink.encoding; | 35 Encoding get encoding => _sink.encoding; |
36 void set encoding(Encoding encoding) { | 36 void set encoding(Encoding encoding) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 } | 114 } |
115 return StdioType.OTHER; | 115 return StdioType.OTHER; |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 class _StdIOUtils { | 119 class _StdIOUtils { |
120 external static IOSink _getStdioOutputStream(int fd); | 120 external static IOSink _getStdioOutputStream(int fd); |
121 external static Stream<List<int>> _getStdioInputStream(); | 121 external static Stream<List<int>> _getStdioInputStream(); |
122 external static int _socketType(nativeSocket); | 122 external static int _socketType(nativeSocket); |
123 } | 123 } |
OLD | NEW |