Files
sdk/runtime/bin/input_stream.dart
T
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00

26 lines
1003 B
Dart

// 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.
/**
* Input is read from a given input stream. Such an input stream can
* be an endpoint, e.g., a socket or a file, or another input stream.
* Multiple input streams can be chained together to operate collaboratively
* on a given input.
*/
interface InputStream {
/**
* Reads [len] bytes into [buffer] buffer starting at [offset] offset.
* [callback] callback is invoked on completion unless it is null.
*/
bool read(List<int> buffer, int offset, int len, void callback());
/**
* Reads data from the stream into a buffer until a given [pattern] occurs and
* hands that buffer over as an input to the registered [callback].
* The callback is not invoked if a read error occurs.
*/
void readUntil(List<int> pattern, void callback(List<int> buffer));
}