mirror of
https://github.com/corda/corda.git
synced 2025-02-06 11:09:18 +00:00
Minor: OpaqueBytes should never be empty. May catch certain types of simple mistake.
This commit is contained in:
parent
6c66eee712
commit
2c27a07c8b
@ -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 */
|
/** 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 {
|
open class OpaqueBytes(val bits: ByteArray) : SerializeableWithKryo {
|
||||||
|
init { check(bits.isNotEmpty()) }
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun of(vararg b: Byte) = OpaqueBytes(byteArrayOf(*b))
|
fun of(vararg b: Byte) = OpaqueBytes(byteArrayOf(*b))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user