Chromium Code Reviews

Unified Diff: lib/src/util/delegating_sink.dart

Issue 1187103004: Allow Suites to be added to an Engine over time. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: lib/src/util/delegating_sink.dart
diff --git a/lib/src/util/delegating_sink.dart b/lib/src/util/delegating_sink.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cc2917f7ffd98a485a5045b4a6fa83364ce96643
--- /dev/null
+++ b/lib/src/util/delegating_sink.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2015, 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.
+
+library test.util.delegating_sink;
+
+// TODO(nweiz): Move this into package:async.
+/// An implementation of [Sink] that forwards all calls to a wrapped [Sink].
+///
+/// This can also be used on a subclass to make it look like a normal [Sink].
+class DelegatingSink<T> implements Sink<T> {
+ /// The wrapped [Sink].
+ final Sink _inner;
+
+ DelegatingSink(this._inner);
+
+ void add(T data) {
+ _inner.add(data);
+ }
+
+ void close() {
+ _inner.close();
+ }
+}

Powered by Google App Engine