Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: runtime/bin/list_input_stream.dart

Issue 8989019: Implement list based output stream and add pipe to list based input streams (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/input_stream.dart ('k') | runtime/bin/list_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/list_input_stream.dart
diff --git a/runtime/bin/list_input_stream.dart b/runtime/bin/list_input_stream.dart
deleted file mode 100644
index 68d60c68e36d9e37ba527a4ef6741ebb3e326e44..0000000000000000000000000000000000000000
--- a/runtime/bin/list_input_stream.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2011, 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;
- }
-
- List<int> _buffer;
- int _offset = 0;
-}
-
-
-class DynamicListInputStream
- extends _BaseDataInputStream implements InputStream {
- DynamicListInputStream() : _bufferList = new _BufferList();
-
- int available() => _bufferList.length;
-
- void write(List<int> data) {
- _bufferList.add(data);
- _checkScheduleCallbacks();
- }
-
- void markEndOfStream() {
- _streamMarkedClosed = true;
- _checkScheduleCallbacks();
- }
-
- 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);
- return bytesToRead;
- }
-
- _BufferList _bufferList;
-}
« no previous file with comments | « runtime/bin/input_stream.dart ('k') | runtime/bin/list_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698