| 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 part of dart.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 // Constants used when working with native ports. | 7 // Constants used when working with native ports. |
| 8 const int _SUCCESS_RESPONSE = 0; | 8 const int _SUCCESS_RESPONSE = 0; |
| 9 const int _ILLEGAL_ARGUMENT_RESPONSE = 1; | 9 const int _ILLEGAL_ARGUMENT_RESPONSE = 1; |
| 10 const int _OSERROR_RESPONSE = 2; | 10 const int _OSERROR_RESPONSE = 2; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 class OSError { | 21 class OSError { |
| 22 /** Constant used to indicate that no OS error code is available. */ | 22 /** Constant used to indicate that no OS error code is available. */ |
| 23 static const int noErrorCode = -1; | 23 static const int noErrorCode = -1; |
| 24 | 24 |
| 25 /** Creates an OSError object from a message and an errorCode. */ | 25 /** Creates an OSError object from a message and an errorCode. */ |
| 26 const OSError([String this.message = "", int this.errorCode = noErrorCode]); | 26 const OSError([String this.message = "", int this.errorCode = noErrorCode]); |
| 27 | 27 |
| 28 /** Converts an OSError object to a string representation. */ | 28 /** Converts an OSError object to a string representation. */ |
| 29 String toString() { | 29 String toString() { |
| 30 StringBuffer sb = new StringBuffer(); | 30 StringBuffer sb = new StringBuffer(); |
| 31 sb.add("OS Error"); | 31 sb.write("OS Error"); |
| 32 if (!message.isEmpty) { | 32 if (!message.isEmpty) { |
| 33 sb.add(": "); | 33 sb.write(": "); |
| 34 sb.add(message); | 34 sb.write(message); |
| 35 if (errorCode != noErrorCode) { | 35 if (errorCode != noErrorCode) { |
| 36 sb.add(", errno = "); | 36 sb.write(", errno = "); |
| 37 sb.add(errorCode.toString()); | 37 sb.write(errorCode.toString()); |
| 38 } | 38 } |
| 39 } else if (errorCode != noErrorCode) { | 39 } else if (errorCode != noErrorCode) { |
| 40 sb.add(": errno = "); | 40 sb.write(": errno = "); |
| 41 sb.add(errorCode.toString()); | 41 sb.write(errorCode.toString()); |
| 42 } | 42 } |
| 43 return sb.toString(); | 43 return sb.toString(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * Error message supplied by the operating system. null if no message is | 47 * Error message supplied by the operating system. null if no message is |
| 48 * associated with the error. | 48 * associated with the error. |
| 49 */ | 49 */ |
| 50 final String message; | 50 final String message; |
| 51 | 51 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 | 91 |
| 92 // TODO(ager): The only reason for the class here is that | 92 // TODO(ager): The only reason for the class here is that |
| 93 // we cannot patch a top-level function. | 93 // we cannot patch a top-level function. |
| 94 class _BufferUtils { | 94 class _BufferUtils { |
| 95 // Check if a List is a builtin VM List type. Returns true | 95 // Check if a List is a builtin VM List type. Returns true |
| 96 // if the List is a builtin VM List type and false if it is | 96 // if the List is a builtin VM List type and false if it is |
| 97 // a user defined List type. | 97 // a user defined List type. |
| 98 external static bool _isBuiltinList(List buffer); | 98 external static bool _isBuiltinList(List buffer); |
| 99 } | 99 } |
| OLD | NEW |