| 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 this._chunkSize) |
| 7 : _chunkSize = chunkSize, _bufferList = new _BufferList() { | 7 : _bufferList = new _BufferList() { |
| 8 if (_chunkSize === null) { | |
| 9 _chunkSize = 0; | |
| 10 } | |
| 11 _input.onClosed = _onClosed; | 8 _input.onClosed = _onClosed; |
| 12 } | 9 } |
| 13 | 10 |
| 14 List<int> read() { | 11 List<int> read() { |
| 15 if (_closed) return null; | 12 if (_closed) return null; |
| 16 var result = _bufferList.readBytes(_chunkSize); | 13 var result = _bufferList.readBytes(_chunkSize); |
| 17 if (result == null) { | 14 if (result == null) { |
| 18 _readData(); | 15 _readData(); |
| 19 result = _bufferList.readBytes(_chunkSize); | 16 result = _bufferList.readBytes(_chunkSize); |
| 20 } | 17 } |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 InputStream _input; | 129 InputStream _input; |
| 133 _BufferList _bufferList; | 130 _BufferList _bufferList; |
| 134 int _chunkSize; | 131 int _chunkSize; |
| 135 bool _inputClosed = false; // Is the underlying input stream closed? | 132 bool _inputClosed = false; // Is the underlying input stream closed? |
| 136 bool _closed = false; // Has the close handler been called?. | 133 bool _closed = false; // Has the close handler been called?. |
| 137 Timer _scheduledDataCallback; | 134 Timer _scheduledDataCallback; |
| 138 Timer _scheduledCloseCallback; | 135 Timer _scheduledCloseCallback; |
| 139 Function _clientDataHandler; | 136 Function _clientDataHandler; |
| 140 Function _clientCloseHandler; | 137 Function _clientCloseHandler; |
| 141 } | 138 } |
| OLD | NEW |