Minor: OpaqueBytes should never be empty. May catch certain types of simple mistake.

This commit is contained in:
Mike Hearn 2015-11-16 19:15:39 +01:00
parent 6c66eee712
commit 2c27a07c8b

View File

@ -7,6 +7,8 @@ import java.util.*
/** A simple class that wraps a byte array and makes the equals/hashCode/toString methods work as you actually expect */
open class OpaqueBytes(val bits: ByteArray) : SerializeableWithKryo {
init { check(bits.isNotEmpty()) }
companion object {
fun of(vararg b: Byte) = OpaqueBytes(byteArrayOf(*b))
}