| Index: runtime/bin/socket_impl.dart
|
| ===================================================================
|
| --- runtime/bin/socket_impl.dart (revision 3811)
|
| +++ runtime/bin/socket_impl.dart (working copy)
|
| @@ -306,19 +306,24 @@
|
| if ((offset + bytes) > buffer.length) {
|
| throw new IndexOutOfRangeException(offset + bytes);
|
| }
|
| - // When using the Dart C API access to ObjectArray by index is
|
| + // When using the Dart C API to access raw data, using a ByteArray is
|
| // currently much faster. This function will make a copy of the
|
| - // supplied List to an ObjectArray if it isn't already.
|
| - ObjectArray outBuffer;
|
| + // supplied List to a ByteArray if it isn't already.
|
| + List outBuffer;
|
| int outOffset = offset;
|
| - if (buffer is ObjectArray) {
|
| + if (buffer is ByteArray || buffer is ObjectArray) {
|
| outBuffer = buffer;
|
| } else {
|
| - outBuffer = new ObjectArray(bytes);
|
| + outBuffer = new ByteArray(bytes);
|
| outOffset = 0;
|
| int j = offset;
|
| for (int i = 0; i < bytes; i++) {
|
| - outBuffer[i] = buffer[j];
|
| + int value = buffer[j];
|
| + if (value is! int) {
|
| + throw new FileIOException(
|
| + "List element is not an integer at index $j");
|
| + }
|
| + outBuffer[i] = value;
|
| j++;
|
| }
|
| }
|
|
|