mirror of
https://github.com/dart-lang/sdk
synced 2024-10-02 23:49:17 +00:00
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>
This commit is contained in:
parent
bd84cff2b1
commit
25b40a0291
|
@ -665,7 +665,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
|
|||
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 @@ class _RawSocket extends Stream<RawSocketEvent> implements RawSocket {
|
|||
|
||||
int available() => _socket.available;
|
||||
|
||||
List<int> read([int len]) {
|
||||
Uint8List read([int len]) {
|
||||
if (_isMacOSTerminalInput) {
|
||||
var available = this.available();
|
||||
if (available == 0) return null;
|
||||
|
|
|
@ -676,7 +676,7 @@ class _RawSecureSocket extends Stream<RawSocketEvent>
|
|||
_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 @@ class _ExternalBuffer {
|
|||
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) {
|
||||
|
|
|
@ -624,7 +624,7 @@ abstract class RawSocket implements Stream<RawSocketEvent> {
|
|||
* 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
|
||||
|
|
Loading…
Reference in a new issue