| OLD | NEW |
| 1 // Copyright (c) 2012, 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 patch class _StdIOUtils { | 5 patch class _StdIOUtils { |
| 6 static InputStream _getStdioInputStream() { | 6 static InputStream _getStdioInputStream() { |
| 7 switch (_getStdioHandleType(0)) { | 7 switch (_getStdioHandleType(0)) { |
| 8 case _STDIO_HANDLE_TYPE_TERMINAL: | 8 case _STDIO_HANDLE_TYPE_TERMINAL: |
| 9 case _STDIO_HANDLE_TYPE_PIPE: | 9 case _STDIO_HANDLE_TYPE_PIPE: |
| 10 case _STDIO_HANDLE_TYPE_SOCKET: | 10 case _STDIO_HANDLE_TYPE_SOCKET: |
| 11 Socket s = new _Socket._internalReadOnly(); | 11 Socket s = new _Socket._internalReadOnly(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 28 Socket s = new _Socket._internalWriteOnly(); | 28 Socket s = new _Socket._internalWriteOnly(); |
| 29 _getStdioHandle(s, fd); | 29 _getStdioHandle(s, fd); |
| 30 s._closed = false; | 30 s._closed = false; |
| 31 return s.outputStream; | 31 return s.outputStream; |
| 32 case _STDIO_HANDLE_TYPE_FILE: | 32 case _STDIO_HANDLE_TYPE_FILE: |
| 33 return new _FileOutputStream.fromStdio(fd); | 33 return new _FileOutputStream.fromStdio(fd); |
| 34 default: | 34 default: |
| 35 throw new FileIOException("Unsupported stdin type"); | 35 throw new FileIOException("Unsupported stdin type"); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 |
| 39 static int _socketType(Socket socket) { |
| 40 return _getSocketType(socket); |
| 41 } |
| 38 } | 42 } |
| 39 | 43 |
| 44 |
| 40 _getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle"; | 45 _getStdioHandle(Socket socket, int num) native "Socket_GetStdioHandle"; |
| 41 _getStdioHandleType(int num) native "File_GetStdioHandleType"; | 46 _getStdioHandleType(int num) native "File_GetStdioHandleType"; |
| 47 _getSocketType(Socket socket) native "Socket_GetType"; |
| OLD | NEW |