From c60c333ba9a710b10377cd47f0841f9c7f44b17b Mon Sep 17 00:00:00 2001
From: Mike Hearn <mike@r3cev.com>
Date: Thu, 11 Aug 2016 16:28:06 +0200
Subject: [PATCH] Minor: add a utility to OpaqueBytes

---
 .../main/kotlin/com/r3corda/core/serialization/ByteArrays.kt  | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/core/src/main/kotlin/com/r3corda/core/serialization/ByteArrays.kt b/core/src/main/kotlin/com/r3corda/core/serialization/ByteArrays.kt
index 7edb68744b..a02d533237 100644
--- a/core/src/main/kotlin/com/r3corda/core/serialization/ByteArrays.kt
+++ b/core/src/main/kotlin/com/r3corda/core/serialization/ByteArrays.kt
@@ -1,6 +1,7 @@
 package com.r3corda.core.serialization
 
 import com.google.common.io.BaseEncoding
+import java.io.ByteArrayInputStream
 import java.util.*
 
 /**
@@ -27,6 +28,9 @@ open class OpaqueBytes(val bits: ByteArray) {
     override fun toString() = "[" + BaseEncoding.base16().encode(bits) + "]"
 
     val size: Int get() = bits.size
+
+    /** Returns a [ByteArrayInputStream] of the bytes */
+    fun open() = ByteArrayInputStream(bits)
 }
 
 fun ByteArray.opaque(): OpaqueBytes = OpaqueBytes(this)