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 class _SocketInputStream implements SocketInputStream { | 5 class _SocketInputStream implements SocketInputStream { |
6 _SocketInputStream(Socket socket) : _socket = socket { | 6 _SocketInputStream(Socket socket) : _socket = socket { |
7 if (_socket._id == -1) _closed = true; | 7 if (_socket._id == -1) _closed = true; |
8 _socket.onClosed = _onClosed; | 8 _socket.onClosed = _onClosed; |
9 } | 9 } |
10 | 10 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 _clientCloseHandler(); | 76 _clientCloseHandler(); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 Socket _socket; | 80 Socket _socket; |
81 Function _clientCloseHandler; | 81 Function _clientCloseHandler; |
82 bool _closed = false; | 82 bool _closed = false; |
83 } | 83 } |
84 | 84 |
85 | 85 |
86 class _SocketOutputStream implements SocketOutputStream { | 86 class _SocketOutputStream |
| 87 extends _BaseOutputStream implements SocketOutputStream { |
87 _SocketOutputStream(Socket socket) | 88 _SocketOutputStream(Socket socket) |
88 : _socket = socket, _pendingWrites = new _BufferList(); | 89 : _socket = socket, _pendingWrites = new _BufferList(); |
89 | 90 |
90 bool write(List<int> buffer, [bool copyBuffer = true]) { | 91 bool write(List<int> buffer, [bool copyBuffer = true]) { |
91 return _write(buffer, 0, buffer.length, copyBuffer); | 92 return _write(buffer, 0, buffer.length, copyBuffer); |
92 } | 93 } |
93 | 94 |
94 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { | 95 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { |
95 return _write( | 96 return _write( |
96 buffer, offset, (len == null) ? buffer.length - offset : len, true); | 97 buffer, offset, (len == null) ? buffer.length - offset : len, true); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 if (_streamErrorHandler != null) _streamErrorHandler(); | 185 if (_streamErrorHandler != null) _streamErrorHandler(); |
185 } | 186 } |
186 | 187 |
187 Socket _socket; | 188 Socket _socket; |
188 _BufferList _pendingWrites; | 189 _BufferList _pendingWrites; |
189 var _onNoPendingWrites; | 190 var _onNoPendingWrites; |
190 var _streamErrorHandler; | 191 var _streamErrorHandler; |
191 bool _closing = false; | 192 bool _closing = false; |
192 bool _closed = false; | 193 bool _closed = false; |
193 } | 194 } |
OLD | NEW |