Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(892)

Side by Side Diff: runtime/bin/socket_stream_impl.dart

Issue 9289042: Minor changes to the dart:io library files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing files. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/socket_stream.dart ('k') | runtime/bin/timer_impl.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, 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 InputStream { 5 class _SocketInputStream implements SocketInputStream {
6 SocketInputStream(Socket socket) : _socket = socket { 6 _SocketInputStream(Socket socket) : _socket = socket {
7 _socket.closeHandler = _closeHandler; 7 _socket.closeHandler = _closeHandler;
8 } 8 }
9 9
10 List<int> read([int len]) { 10 List<int> read([int len]) {
11 int bytesToRead = available(); 11 int bytesToRead = available();
12 if (bytesToRead == 0) return null; 12 if (bytesToRead == 0) return null;
13 if (len !== null) { 13 if (len !== null) {
14 if (len <= 0) { 14 if (len <= 0) {
15 throw new StreamException("Illegal length $len"); 15 throw new StreamException("Illegal length $len");
16 } else if (bytesToRead > len) { 16 } else if (bytesToRead > len) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 _closed = true; 68 _closed = true;
69 if (_clientCloseHandler !== null) _clientCloseHandler(); 69 if (_clientCloseHandler !== null) _clientCloseHandler();
70 } 70 }
71 71
72 Socket _socket; 72 Socket _socket;
73 Function _clientCloseHandler; 73 Function _clientCloseHandler;
74 bool _closed = false; 74 bool _closed = false;
75 } 75 }
76 76
77 77
78 class SocketOutputStream implements OutputStream { 78 class _SocketOutputStream implements SocketOutputStream {
79 SocketOutputStream(Socket socket) 79 _SocketOutputStream(Socket socket)
80 : _socket = socket, _pendingWrites = new _BufferList(); 80 : _socket = socket, _pendingWrites = new _BufferList();
81 81
82 bool write(List<int> buffer, [bool copyBuffer = true]) { 82 bool write(List<int> buffer, [bool copyBuffer = true]) {
83 return _write(buffer, 0, buffer.length, copyBuffer); 83 return _write(buffer, 0, buffer.length, copyBuffer);
84 } 84 }
85 85
86 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { 86 bool writeFrom(List<int> buffer, [int offset = 0, int len]) {
87 return _write( 87 return _write(
88 buffer, offset, (len == null) ? buffer.length - offset : len, true); 88 buffer, offset, (len == null) ? buffer.length - offset : len, true);
89 } 89 }
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (_streamErrorHandler != null) _streamErrorHandler(); 180 if (_streamErrorHandler != null) _streamErrorHandler();
181 } 181 }
182 182
183 Socket _socket; 183 Socket _socket;
184 _BufferList _pendingWrites; 184 _BufferList _pendingWrites;
185 var _noPendingWriteHandler; 185 var _noPendingWriteHandler;
186 var _streamErrorHandler; 186 var _streamErrorHandler;
187 bool _closing = false; 187 bool _closing = false;
188 bool _closed = false; 188 bool _closed = false;
189 } 189 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_stream.dart ('k') | runtime/bin/timer_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698