Chromium Code Reviews| Index: lib/io/socket_stream_impl.dart |
| diff --git a/lib/io/socket_stream_impl.dart b/lib/io/socket_stream_impl.dart |
| index e56334c5c94732045a734f20ab211a9aafe2a6da..c8799b1ba7da7cf9d22d21f7e669890ec83a09bd 100644 |
| --- a/lib/io/socket_stream_impl.dart |
| +++ b/lib/io/socket_stream_impl.dart |
| @@ -9,30 +9,7 @@ class _SocketInputStream implements InputStream { |
| } |
| List<int> read([int len]) { |
| - int bytesToRead = available(); |
| - if (bytesToRead == 0) return null; |
| - if (len !== null) { |
| - if (len <= 0) { |
| - throw new StreamException("Illegal length $len"); |
| - } else if (bytesToRead > len) { |
| - bytesToRead = len; |
| - } |
| - } |
| - List<int> buffer = new Uint8List(bytesToRead); |
| - int bytesRead = _socket.readList(buffer, 0, bytesToRead); |
| - if (bytesRead == 0) { |
| - // On MacOS when reading from a tty Ctrl-D will result in one |
| - // byte reported as available. Attempting to read it out will |
| - // result in zero bytes read. When that happens there is no data |
| - // which is indicated by a null return value. |
| - return null; |
| - } else if (bytesRead < bytesToRead) { |
| - List<int> newBuffer = new Uint8List(bytesRead); |
| - newBuffer.setRange(0, bytesRead, buffer); |
| - return newBuffer; |
| - } else { |
| - return buffer; |
| - } |
| + return _socket.read(len); |
|
Mads Ager (google)
2012/10/31 07:06:22
Yay!
|
| } |
| int readInto(List<int> buffer, [int offset = 0, int len]) { |