| 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 _ChunkedInputStream implements ChunkedInputStream { | 5 class _ChunkedInputStream implements ChunkedInputStream { |
| 6 _ChunkedInputStream(InputStream this._input, [int chunkSize]) | 6 _ChunkedInputStream(InputStream this._input, [int chunkSize]) |
| 7 : _chunkSize = chunkSize, _bufferList = new _BufferList() { | 7 : _chunkSize = chunkSize, _bufferList = new _BufferList() { |
| 8 if (_chunkSize === null) { | 8 if (_chunkSize === null) { |
| 9 _chunkSize = 0; | 9 _chunkSize = 0; |
| 10 } | 10 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 if (_bufferList.length == 0) { | 22 if (_bufferList.length == 0) { |
| 23 result = null; | 23 result = null; |
| 24 } else { | 24 } else { |
| 25 result = _bufferList.readBytes(_bufferList.length); | 25 result = _bufferList.readBytes(_bufferList.length); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 _checkInstallDataHandler(); | 28 _checkInstallDataHandler(); |
| 29 return result; | 29 return result; |
| 30 } | 30 } |
| 31 | 31 |
| 32 int get chunkSize() => _chunkSize; | 32 int get chunkSize => _chunkSize; |
| 33 | 33 |
| 34 void set chunkSize(int chunkSize) { | 34 void set chunkSize(int chunkSize) { |
| 35 _chunkSize = chunkSize; | 35 _chunkSize = chunkSize; |
| 36 _checkInstallDataHandler(); | 36 _checkInstallDataHandler(); |
| 37 _checkScheduleCallback(); | 37 _checkScheduleCallback(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool get closed() => _closed; | 40 bool get closed => _closed; |
| 41 | 41 |
| 42 void set onData(void callback()) { | 42 void set onData(void callback()) { |
| 43 _clientDataHandler = callback; | 43 _clientDataHandler = callback; |
| 44 _checkInstallDataHandler(); | 44 _checkInstallDataHandler(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void set onClosed(void callback()) { | 47 void set onClosed(void callback()) { |
| 48 _clientCloseHandler = callback; | 48 _clientCloseHandler = callback; |
| 49 } | 49 } |
| 50 | 50 |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 InputStream _input; | 132 InputStream _input; |
| 133 _BufferList _bufferList; | 133 _BufferList _bufferList; |
| 134 int _chunkSize; | 134 int _chunkSize; |
| 135 bool _inputClosed = false; // Is the underlying input stream closed? | 135 bool _inputClosed = false; // Is the underlying input stream closed? |
| 136 bool _closed = false; // Has the close handler been called?. | 136 bool _closed = false; // Has the close handler been called?. |
| 137 Timer _scheduledDataCallback; | 137 Timer _scheduledDataCallback; |
| 138 Timer _scheduledCloseCallback; | 138 Timer _scheduledCloseCallback; |
| 139 Function _clientDataHandler; | 139 Function _clientDataHandler; |
| 140 Function _clientCloseHandler; | 140 Function _clientCloseHandler; |
| 141 } | 141 } |
| OLD | NEW |