Update RawSocket.read to return Uint8List
Bug: https://github.com/dart-lang/sdk/issues/36900
Change-Id: I0940d86dadce0acd41fb639a4598ffa36569c11a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/104522
Commit-Queue: Todd Volkert <tvolkert@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index eb01395..9bb1b94 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -665,7 +665,7 @@
String get _serviceTypePath => throw new UnimplementedError();
String get _serviceTypeName => throw new UnimplementedError();
- List<int> read(int len) {
+ Uint8List read(int len) {
if (len != null && len <= 0) {
throw new ArgumentError("Illegal length $len");
}
@@ -1378,7 +1378,7 @@
int available() => _socket.available;
- List<int> read([int len]) {
+ Uint8List read([int len]) {
if (_isMacOSTerminalInput) {
var available = this.available();
if (available == 0) return null;
diff --git a/sdk/lib/io/secure_socket.dart b/sdk/lib/io/secure_socket.dart
index 463a445..c37f75e 100644
--- a/sdk/lib/io/secure_socket.dart
+++ b/sdk/lib/io/secure_socket.dart
@@ -676,7 +676,7 @@
_scheduleReadEvent();
}
- List<int> read([int length]) {
+ Uint8List read([int length]) {
if (length != null && (length is! int || length < 0)) {
throw new ArgumentError(
"Invalid length parameter in SecureSocket.read (length: $length)");
@@ -1157,14 +1157,14 @@
return size - end;
}
- List<int> read(int bytes) {
+ Uint8List read(int bytes) {
if (bytes == null) {
bytes = length;
} else {
bytes = min(bytes, length);
}
if (bytes == 0) return null;
- List<int> result = new Uint8List(bytes);
+ Uint8List result = new Uint8List(bytes);
int bytesRead = 0;
// Loop over zero, one, or two linear data ranges.
while (bytesRead < bytes) {
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index cb0f78c..63b32b3 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -624,7 +624,7 @@
* available for immediate reading. If no data is available [:null:]
* is returned.
*/
- List<int> read([int len]);
+ Uint8List read([int len]);
/**
* Writes up to [count] bytes of the buffer from [offset] buffer offset to