Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Unified Diff: sdk/lib/io/stdio.dart

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/socket_stream_impl.dart ('k') | sdk/lib/io/stream_util.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/stdio.dart
diff --git a/sdk/lib/io/stdio.dart b/sdk/lib/io/stdio.dart
index ae664887343106d5dd94409a279093386c0f7999..d460edde2f642edf366142ceae7e568420cd9de1 100644
--- a/sdk/lib/io/stdio.dart
+++ b/sdk/lib/io/stdio.dart
@@ -21,12 +21,12 @@ class StdioType {
}
-InputStream _stdin;
-OutputStream _stdout;
-OutputStream _stderr;
+Stream<List<int>> _stdin;
+IOSink _stdout;
+IOSink _stderr;
-InputStream get stdin {
+Stream<List<int>> get stdin {
if (_stdin == null) {
_stdin = _StdIOUtils._getStdioInputStream();
}
@@ -34,7 +34,7 @@ InputStream get stdin {
}
-OutputStream get stdout {
+IOSink get stdout {
if (_stdout == null) {
_stdout = _StdIOUtils._getStdioOutputStream(1);
}
@@ -42,7 +42,7 @@ OutputStream get stdout {
}
-OutputStream get stderr {
+IOSink get stderr {
if (_stderr == null) {
_stderr = _StdIOUtils._getStdioOutputStream(2);
}
@@ -51,23 +51,31 @@ OutputStream get stderr {
StdioType stdioType(object) {
- if (object is _FileOutputStream || object is _FileInputStream) {
+ if (object is _FileStream) {
return StdioType.FILE;
}
- if (object is !_SocketOutputStream && object is !_SocketInputStream) {
- return StdioType.OTHER;
+ if (object is Socket) {
+ switch (_StdIOUtils._socketType(object._nativeSocket)) {
+ case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL;
+ case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE;
+ case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE;
+ }
}
- switch (_StdIOUtils._socketType(object._socket)) {
- case _STDIO_HANDLE_TYPE_TERMINAL: return StdioType.TERMINAL;
- case _STDIO_HANDLE_TYPE_PIPE: return StdioType.PIPE;
- case _STDIO_HANDLE_TYPE_FILE: return StdioType.FILE;
- default: return StdioType.OTHER;
+ if (object is IOSink) {
+ try {
+ if (object._sink.target is _FileStreamConsumer) {
+ return StdioType.FILE;
+ }
+ } catch (e) {
+ // Only the interface implemented, _sink not available.
+ }
}
+ return StdioType.OTHER;
}
class _StdIOUtils {
external static OutputStream _getStdioOutputStream(int fd);
external static InputStream _getStdioInputStream();
- external static int _socketType(Socket socket);
+ external static int _socketType(nativeSocket);
}
« no previous file with comments | « sdk/lib/io/socket_stream_impl.dart ('k') | sdk/lib/io/stream_util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698