| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 /// Helper functionality to make working with IO easier. | 5 /// Helper functionality to make working with IO easier. |
| 6 library io; | 6 library io; |
| 7 | 7 |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 import 'dart:io'; | 9 import 'dart:io'; |
| 10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| (...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 904 // TODO(rnystrom): Should log the stderr and display it if an actual error | 904 // TODO(rnystrom): Should log the stderr and display it if an actual error |
| 905 // occurs. | 905 // occurs. |
| 906 store(process.stdout, controller); | 906 store(process.stdout, controller); |
| 907 }); | 907 }); |
| 908 }).catchError((e) { | 908 }).catchError((e) { |
| 909 // We don't have to worry about double-signaling here, since the store() | 909 // We don't have to worry about double-signaling here, since the store() |
| 910 // above will only be reached if everything succeeds. | 910 // above will only be reached if everything succeeds. |
| 911 controller.signalError(e.error, e.stackTrace); | 911 controller.signalError(e.error, e.stackTrace); |
| 912 controller.close(); | 912 controller.close(); |
| 913 }); | 913 }); |
| 914 return new ByteStream(controller); | 914 return new ByteStream(controller.stream); |
| 915 } | 915 } |
| 916 | 916 |
| 917 /// Exception thrown when an operation times out. | 917 /// Exception thrown when an operation times out. |
| 918 class TimeoutException implements Exception { | 918 class TimeoutException implements Exception { |
| 919 final String message; | 919 final String message; |
| 920 | 920 |
| 921 const TimeoutException(this.message); | 921 const TimeoutException(this.message); |
| 922 | 922 |
| 923 String toString() => message; | 923 String toString() => message; |
| 924 } | 924 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 949 Directory _getDirectory(entry) { | 949 Directory _getDirectory(entry) { |
| 950 if (entry is Directory) return entry; | 950 if (entry is Directory) return entry; |
| 951 return new Directory(entry); | 951 return new Directory(entry); |
| 952 } | 952 } |
| 953 | 953 |
| 954 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 954 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
| 955 Uri _getUri(uri) { | 955 Uri _getUri(uri) { |
| 956 if (uri is Uri) return uri; | 956 if (uri is Uri) return uri; |
| 957 return Uri.parse(uri); | 957 return Uri.parse(uri); |
| 958 } | 958 } |
| OLD | NEW |