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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { | 60 bool writeFrom(List<int> buffer, [int offset = 0, int len]) { |
61 if (_streamMarkedClosed) throw new StreamException.streamClosed(); | 61 if (_streamMarkedClosed) throw new StreamException.streamClosed(); |
62 _bufferList.add( | 62 _bufferList.add( |
63 buffer.getRange(offset, (len == null) ? buffer.length - offset : len)); | 63 buffer.getRange(offset, (len == null) ? buffer.length - offset : len)); |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
| 67 void flush() { |
| 68 // Nothing to do on a list output stream. |
| 69 } |
| 70 |
67 void close() { | 71 void close() { |
68 if (_streamMarkedClosed) throw new StreamException.streamClosed(); | 72 if (_streamMarkedClosed) throw new StreamException.streamClosed(); |
69 _streamMarkedClosed = true; | 73 _streamMarkedClosed = true; |
70 } | 74 } |
71 | 75 |
72 void destroy() { | 76 void destroy() { |
73 close(); | 77 close(); |
74 } | 78 } |
75 | 79 |
76 void set onNoPendingWrites(void callback()) { | 80 void set onNoPendingWrites(void callback()) { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 125 } |
122 | 126 |
123 _BufferList _bufferList; | 127 _BufferList _bufferList; |
124 bool _streamMarkedClosed = false; | 128 bool _streamMarkedClosed = false; |
125 bool _closeCallbackCalled = false; | 129 bool _closeCallbackCalled = false; |
126 Timer _scheduledNoPendingWriteCallback; | 130 Timer _scheduledNoPendingWriteCallback; |
127 Timer _scheduledCloseCallback; | 131 Timer _scheduledCloseCallback; |
128 Function _clientNoPendingWriteHandler; | 132 Function _clientNoPendingWriteHandler; |
129 Function _clientCloseHandler; | 133 Function _clientCloseHandler; |
130 } | 134 } |
OLD | NEW |