| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // Utility class which can deliver bytes one by one from a number of | 5 // Utility class which can deliver bytes one by one from a number of |
| 6 // buffers added. | 6 // buffers added. |
| 7 class _BufferList { | 7 class _BufferList { |
| 8 _BufferList() : _index = 0, _length = 0, _buffers = new Queue(); | 8 _BufferList() : _index = 0, _length = 0, _buffers = new Queue(); |
| 9 | 9 |
| 10 void add(List<int> buffer) { | 10 void add(List<int> buffer) { |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 void _closeHandler() { | 248 void _closeHandler() { |
| 249 _inputClosed = true; | 249 _inputClosed = true; |
| 250 if (_buffer !== null || !_decoder.isEmpty()) { | 250 if (_buffer !== null || !_decoder.isEmpty()) { |
| 251 // If there is still data buffered in either the buffer or the | 251 // If there is still data buffered in either the buffer or the |
| 252 // decoder call the data handler. | 252 // decoder call the data handler. |
| 253 if (_clientDataHandler !== null) _clientDataHandler(); | 253 if (_clientDataHandler !== null) _clientDataHandler(); |
| 254 } else { | 254 } else { |
| 255 closed_ = true; | 255 _closed = true; |
| 256 if (_clientCloseHandler !== null) _clientCloseHandler(); | 256 if (_clientCloseHandler !== null) _clientCloseHandler(); |
| 257 } | 257 } |
| 258 } | 258 } |
| 259 | 259 |
| 260 void _readData() { | 260 void _readData() { |
| 261 List<int> data = _input.read(); | 261 List<int> data = _input.read(); |
| 262 if (data !== null) { | 262 if (data !== null) { |
| 263 _decoder.write(data); | 263 _decoder.write(data); |
| 264 } | 264 } |
| 265 } | 265 } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 String _encoding; | 345 String _encoding; |
| 346 _Decoder _decoder; | 346 _Decoder _decoder; |
| 347 String _buffer; // String can be buffered here if readLine is used. | 347 String _buffer; // String can be buffered here if readLine is used. |
| 348 int _bufferLineStart; // Current offset into _buffer if any. | 348 int _bufferLineStart; // Current offset into _buffer if any. |
| 349 bool _inputClosed = false; // Is the underlying input stream closed? | 349 bool _inputClosed = false; // Is the underlying input stream closed? |
| 350 bool _closed = false; // Is this stream closed. | 350 bool _closed = false; // Is this stream closed. |
| 351 bool _eof = false; // Has all data been read from the decoder? | 351 bool _eof = false; // Has all data been read from the decoder? |
| 352 var _clientDataHandler; | 352 var _clientDataHandler; |
| 353 var _clientCloseHandler; | 353 var _clientCloseHandler; |
| 354 } | 354 } |
| OLD | NEW |