Chromium Code Reviews| Index: runtime/bin/filter.dart |
| diff --git a/runtime/bin/filter.dart b/runtime/bin/filter.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c42fa3e8a16de1ae1a66ee4ccc0a4ffaf947098f |
| --- /dev/null |
| +++ b/runtime/bin/filter.dart |
| @@ -0,0 +1,36 @@ |
| +// 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. |
| + |
| + |
| +abstract class _Filter { |
| + /** |
| + * Call to process a chunk of data. A call to [process] should only be made |
| + * when [processed] returns [null]. |
| + */ |
| + void process(List<int> data); |
| + |
| + /** |
| + * Get a chunk of processed data. When there are no more data available, |
| + * [processed] will return [null]. Set [flush] to [false] for non-final |
| + * calls to improve performance of some filters. |
| + */ |
| + List<int> processed([bool flush = true]); |
|
Søren Gjesse
2012/10/25 11:01:44
Maybe named argument instead of positional.
|
| + |
| + /** |
| + * Mark the filter as closed. Always call this method for any filter created |
| + * to avoid leaking resources. [end] can be called at any time, but any |
| + * successive calls to [process] or [processed] will fail. |
| + */ |
| + void end(); |
| +} |
| + |
| +class GZipDeflateFilter implements _Filter { |
| + factory GZipDeflateFilter() |
| + => new _GZipDeflateFilterImpl(); |
| +} |
| + |
| +class ZLibInflateFilter implements _Filter { |
| + factory ZLibInflateFilter() => new _ZLibInflateFilterImpl(); |
| +} |
| + |