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

Unified Diff: lib/src/digest_sink.dart

Issue 1355223002: Change Hash subclasses to be Converters. (Closed) Base URL: git@github.com:dart-lang/crypto.git@master
Patch Set: Add docs Created 5 years, 3 months 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
Index: lib/src/digest_sink.dart
diff --git a/lib/src/digest_sink.dart b/lib/src/digest_sink.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0b24a51585c618584c9f3e28870142f8e97eb983
--- /dev/null
+++ b/lib/src/digest_sink.dart
@@ -0,0 +1,26 @@
+// 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 crypto.digest_sink;
+
+import 'digest.dart';
+
+/// A sink used to get a digest value out of [Hash.startChunkedConversion].
+class DigestSink extends Sink<Digest> {
+ /// The value added to the sink, if any.
+ Digest get value {
+ assert(_value != null);
+ return _value;
+ }
+ Digest _value;
+
+ void add(Digest value) {
Bob Nystrom 2015/09/22 17:47:31 Document that this can only be called once.
nweiz 2015/09/22 21:37:33 Done.
+ assert(_value == null);
+ _value = value;
+ }
+
+ void close() {
+ assert(_value != null);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698