| 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 /** | 5 /** |
| 6 * Default implementation of [ListInputStream]. | 6 * Default implementation of [ListInputStream]. |
| 7 */ | 7 */ |
| 8 class _ListInputStream extends _BaseDataInputStream implements ListInputStream { | 8 class _ListInputStream extends _BaseDataInputStream implements ListInputStream { |
| 9 _ListInputStream() : _bufferList = new _BufferList(); | 9 _ListInputStream() : _bufferList = new _BufferList(); |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 void _close() { | 36 void _close() { |
| 37 _streamMarkedClosed = true; | 37 _streamMarkedClosed = true; |
| 38 _bufferList.clear(); | 38 _bufferList.clear(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 _BufferList _bufferList; | 41 _BufferList _bufferList; |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 class _ListOutputStream implements ListOutputStream { | 45 class _ListOutputStream extends _BaseOutputStream implements ListOutputStream { |
| 46 _ListOutputStream() : _bufferList = new _BufferList(); | 46 _ListOutputStream() : _bufferList = new _BufferList(); |
| 47 | 47 |
| 48 List<int> contents() => _bufferList.readBytes(_bufferList.length); | 48 List<int> contents() => _bufferList.readBytes(_bufferList.length); |
| 49 | 49 |
| 50 bool write(List<int> buffer, [bool copyBuffer = false]) { | 50 bool write(List<int> buffer, [bool copyBuffer = false]) { |
| 51 if (_streamMarkedClosed) throw new StreamException.streamClosed(); | 51 if (_streamMarkedClosed) throw new StreamException.streamClosed(); |
| 52 if (copyBuffer) { | 52 if (copyBuffer) { |
| 53 _bufferList.add(buffer.getRange(0, buffer.length)); | 53 _bufferList.add(buffer.getRange(0, buffer.length)); |
| 54 } else { | 54 } else { |
| 55 _bufferList.add(buffer); | 55 _bufferList.add(buffer); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 | 122 |
| 123 _BufferList _bufferList; | 123 _BufferList _bufferList; |
| 124 bool _streamMarkedClosed = false; | 124 bool _streamMarkedClosed = false; |
| 125 bool _closeCallbackCalled = false; | 125 bool _closeCallbackCalled = false; |
| 126 Timer _scheduledNoPendingWriteCallback; | 126 Timer _scheduledNoPendingWriteCallback; |
| 127 Timer _scheduledCloseCallback; | 127 Timer _scheduledCloseCallback; |
| 128 Function _clientNoPendingWriteHandler; | 128 Function _clientNoPendingWriteHandler; |
| 129 Function _clientCloseHandler; | 129 Function _clientCloseHandler; |
| 130 } | 130 } |
| OLD | NEW |