decodeSafely

internal fun <T : Any> TypeCodec<T>.decodeSafely(data: ByteArray, offset: Int, length: Int): T

Safely decodes a value using this TypeCodec. Any standard exceptions (like IllegalArgumentException or IllegalStateException) thrown by the codec's TypeCodec.fromBinary method are caught and wrapped in a CodecException.