tuweni / org.apache.tuweni.bytes / Bytes / toArrayUnsafe

toArrayUnsafe

open fun toArrayUnsafe(): ByteArray! (source)

Get the bytes represented by this value as byte array.

Contrarily to #toArray(), this may avoid allocating a new array and directly return the backing array of this value if said value is array backed and doing so is possible. As such, modifications to the returned array may or may not impact this value. As such, this method should be used with care and hence the "unsafe" moniker.

Return
ByteArray!: A byte array with the same content than this value, which may or may not be the direct backing of this value.