| Index: runtime/bin/list_stream_impl.dart
|
| diff --git a/runtime/bin/list_stream.dart b/runtime/bin/list_stream_impl.dart
|
| similarity index 73%
|
| copy from runtime/bin/list_stream.dart
|
| copy to runtime/bin/list_stream_impl.dart
|
| index f925d529ec8eb7d06a1eefc22d83c082dcf4adbd..7048922cbe54fc89c4e66a86d4d61807a67cb590 100644
|
| --- a/runtime/bin/list_stream.dart
|
| +++ b/runtime/bin/list_stream_impl.dart
|
| @@ -1,45 +1,12 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -class ListInputStream extends _BaseDataInputStream implements InputStream {
|
| - ListInputStream(List<int> this._buffer) {
|
| - _streamMarkedClosed = true;
|
| - }
|
| -
|
| - int available() => _buffer.length - _offset;
|
| -
|
| - List<int> _read(int bytesToRead) {
|
| - if (_offset == 0 && bytesToRead == _buffer.length) {
|
| - _offset = _buffer.length;
|
| - return _buffer;
|
| - } else {
|
| - List<int> result = _buffer.getRange(_offset, bytesToRead);
|
| - _offset += bytesToRead;
|
| - return result;
|
| - }
|
| - }
|
| -
|
| - int _readInto(List<int> buffer, int offset, int bytesToRead) {
|
| - buffer.setRange(offset, bytesToRead, _buffer, _offset);
|
| - _offset += bytesToRead;
|
| - return bytesToRead;
|
| - }
|
| -
|
| - void _close() {
|
| - _offset = _buffer.length;
|
| - }
|
| -
|
| - List<int> _buffer;
|
| - int _offset = 0;
|
| -}
|
| -
|
| -
|
| -class DynamicListInputStream
|
| - extends _BaseDataInputStream implements InputStream {
|
| - DynamicListInputStream() : _bufferList = new _BufferList();
|
| -
|
| - int available() => _bufferList.length;
|
| +/**
|
| + * Default implementation of [ListInputStream].
|
| + */
|
| +class _ListInputStream extends _BaseDataInputStream implements ListInputStream {
|
| + _ListInputStream() : _bufferList = new _BufferList();
|
|
|
| void write(List<int> data) {
|
| if (_streamMarkedClosed) {
|
| @@ -54,13 +21,15 @@ class DynamicListInputStream
|
| _checkScheduleCallbacks();
|
| }
|
|
|
| + int available() => _bufferList.length;
|
| +
|
| List<int> _read(int bytesToRead) {
|
| return _bufferList.readBytes(bytesToRead);
|
| }
|
|
|
| int _readInto(List<int> buffer, int offset, int bytesToRead) {
|
| - List<int> tmp = _bufferList.readBytes(byteToRead);
|
| - buffer.setRange(offset, bytesToRead, tmp, _offset);
|
| + List<int> tmp = _bufferList.readBytes(bytesToRead);
|
| + buffer.setRange(offset, bytesToRead, tmp, 0);
|
| return bytesToRead;
|
| }
|
|
|
| @@ -73,8 +42,10 @@ class DynamicListInputStream
|
| }
|
|
|
|
|
| -class ListOutputStream implements OutputStream {
|
| - ListOutputStream() : _bufferList = new _BufferList();
|
| +class _ListOutputStream implements ListOutputStream {
|
| + _ListOutputStream() : _bufferList = new _BufferList();
|
| +
|
| + List<int> contents() => _bufferList.readBytes(_bufferList.length);
|
|
|
| bool write(List<int> buffer, [bool copyBuffer = false]) {
|
| if (_streamMarkedClosed) throw new StreamException.streamClosed();
|
| @@ -115,8 +86,6 @@ class ListOutputStream implements OutputStream {
|
| // No errors emitted.
|
| }
|
|
|
| - List<int> contents() => _bufferList.readBytes(_bufferList.length);
|
| -
|
| void _checkScheduleCallbacks() {
|
| void issueNoPendingWriteCallback(Timer timer) {
|
| _scheduledNoPendingWriteCallback = null;
|
|
|