| 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 // Interface for decoders decoding binary data into string data. The | 5 // Interface for decoders decoding binary data into string data. The |
| 6 // decoder keeps track of line breaks during decoding. | 6 // decoder keeps track of line breaks during decoding. |
| 7 interface _StringDecoder { | 7 interface _StringDecoder { |
| 8 // Add more binary data to be decoded. The ownership of the buffer | 8 // Add more binary data to be decoded. The ownership of the buffer |
| 9 // is transfered to the decoder and the caller most not modify it any more. | 9 // is transfered to the decoder and the caller most not modify it any more. |
| 10 int write(List<int> buffer); | 10 int write(List<int> buffer); |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 _clientLineHandler = callback; | 387 _clientLineHandler = callback; |
| 388 _clientDataHandler = null; | 388 _clientDataHandler = null; |
| 389 _checkInstallDataHandler(); | 389 _checkInstallDataHandler(); |
| 390 _checkScheduleCallback(); | 390 _checkScheduleCallback(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 void set onClosed(void callback()) { | 393 void set onClosed(void callback()) { |
| 394 _clientCloseHandler = callback; | 394 _clientCloseHandler = callback; |
| 395 } | 395 } |
| 396 | 396 |
| 397 void set onError(void callback(Exception e)) { | 397 void set onError(void callback(e)) { |
| 398 _input.onError = callback; | 398 _input.onError = callback; |
| 399 } | 399 } |
| 400 | 400 |
| 401 void _onData() { | 401 void _onData() { |
| 402 _readData(); | 402 _readData(); |
| 403 if (!_decoder.isEmpty() && _clientDataHandler !== null) { | 403 if (!_decoder.isEmpty() && _clientDataHandler !== null) { |
| 404 _clientDataHandler(); | 404 _clientDataHandler(); |
| 405 } | 405 } |
| 406 if (_decoder.lineBreaks > 0 && _clientLineHandler !== null) { | 406 if (_decoder.lineBreaks > 0 && _clientLineHandler !== null) { |
| 407 _clientLineHandler(); | 407 _clientLineHandler(); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 bool _inputClosed = false; // Is the underlying input stream closed? | 510 bool _inputClosed = false; // Is the underlying input stream closed? |
| 511 bool _closed = false; // Is this stream closed. | 511 bool _closed = false; // Is this stream closed. |
| 512 bool _eof = false; // Has all data been read from the decoder? | 512 bool _eof = false; // Has all data been read from the decoder? |
| 513 Timer _scheduledDataCallback; | 513 Timer _scheduledDataCallback; |
| 514 Timer _scheduledLineCallback; | 514 Timer _scheduledLineCallback; |
| 515 Timer _scheduledCloseCallback; | 515 Timer _scheduledCloseCallback; |
| 516 Function _clientDataHandler; | 516 Function _clientDataHandler; |
| 517 Function _clientLineHandler; | 517 Function _clientLineHandler; |
| 518 Function _clientCloseHandler; | 518 Function _clientCloseHandler; |
| 519 } | 519 } |
| OLD | NEW |